I wish to add a scroll bar to the window that opens when i click on the retriever button - before anyone asks Yes this was once for a controlled assessment but now i am using the pre existing code to learn tkinter with
def retrieve():
exist = os.path.isfile('messages.txt')
if exist == True:
w = Toplevel(master=gui)
x = 1
list = [i.strip().split() for i in open("messages.txt").readlines()]
l = len(list)
i = 0
while i < l:
x = str(x)
Label(w, text = "input " + x).pack()
Label(w, text = (list[i])).pack()
i = i + 1
Label(w, text ="offset " + x).pack()
Label(w, text =(str(list[i]))).pack()
i = i + 1
Label(w, text ="output " + x).pack()
Label(w, text =(list[i])).pack()
i = i + 1
Label(w, text =" ").pack()
x = int(x)
x = x + 1
else:
labelprint = "No Stored Messages"
add = Label(gui, text = labelprint, width = 30)
add.grid(row = 2, column =2)
gui = Tk()
gui.title("Encoder")
Button(gui, text="Retriever", command=retrieve).grid(row = 1, column = 0)
mainloop( )