Thanks in advance for any help! I'm just learning Python and Tkinter. Can anyone suggest why this program does not insert 'some text' into text box t1 when the start button is clicked? No errors are thrown when I run the program in PyCharm
from tkinter import * class Window(Frame): t1 = [] def __init__(self, master=None) Frame.__init__(self, master) self.master = master self.master.title("My Title") StartButton = Button(self, text="Start", command=self.start, bg= '#006ba6', fg="white") StartButton.grid(row=0, columnspan=3, sticky=(N, S, W, E)) Label(self, text="Your Name").grid(row=1, sticky=(N, S, W, E)) t1 = Text(self, height=2) t1.grid(row=1, column=1, sticky=(N, S, W, E)) self.t1.insert( 0, 'some text') quitButton = Button(self, text="Quit", command=self.client_quit, bg='#006ba6', fg="white") quitButton.grid(row=5, columnspan=3, sticky=(N, S, W, E)) self.grid(sticky=(N, S, W, E)) def start(self): self.t1.insert(0, 'some text') def client_quit(self): exit() root = Tk() root.geometry() app = Window(root) root.mainloop() Alan Dickman IBM Cloud Technical Sales Specialist, Process Transformation North America Public Sector Email: adick...@us.ibm.com Mobile: +1 303 324 9353 Find me on: LinkedIn
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss