super() in tkinter application super() in tkinter application tkinter tkinter

super() in tkinter application


Python 3 super does not require to pass self as an argument.

The following example illustrates the correct way to call super to initialize the parent class of a widget:

import tkinter as tk class Application(tk.Frame):    def __init__(self, parent):        super().__init__(parent)        tk.Button(self, text='Super!', command=root.destroy).pack()root = tk.Tk()Application(root).pack()root.mainloop()

The reason is that the python core developers decided to simplify the use of super, and abstracted the passing of self to the underlying code that powers python.
more info