I sneaked up on Tkinter when I looked at the minimal example from the NMT Tkinter 8.5 Reference .
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='Quit',command=self.quit)
self.quitButton.grid()
app = Application()
app.master.title('Sample application')
app.mainloop()
Everything is fine and good, until I noticed that the class is Tknot initialized. In other online reference materials, I could find ( Python Library Reference , effbot.org , TkDocs ) a call usually appears root = tk.Tk(), from which the rest of the examples are built. I also did not see any class initialization Tkreference anywhere in the NMT reference. A.
, Tk, , Python Reference, " ... ". , , :
root = tk.Tk()
app = Application(root)
, . , :
root = tk.Tk() ( , ) ?- ,
Tk() Frame?