Reputation: 8423
I am using Tkinter with python 2.7 and am curious about why the following code snippet would work:
import Tkinter as tk
import ttk
class Application(ttk.Frame):
def __init__(self, master=None):
ttk.Frame.__init__(self, master) # This is where my question is
self.grid()
return
if __name__ == '__main__':
root = tk.Tk()
app = Application(root)
root.mainloop()
1) The ttk.Frame.__init__
takes one argument, which is the master
. But now the first argument is an instance inherited from it, and the second is master
. How did this work?
2) I noticed that the ttk.Frame
class also have a function called mainloop
. How is this different from root.mainloop()
?
Thanks!
Upvotes: 1
Views: 210