Home > OS >  Tkinter window not showing up (even after using mainloop)
Tkinter window not showing up (even after using mainloop)

Time:09-22

I'm making a customized type of tk root for my app (So that I don't have to reconfigure all the layout for a TopLevel), but the mainloop method is not working (My app window is not displaying).

Here is how I proceeded:

from tkinter import *

class a_customized_window(Tk):
    def __init__(self):
        self.title("A custom window")

win=a_customized_window()
win.mainloop()

CodePudding user response:

You need to call the __init__() of the parent class inside __init__() of the custom class:

from tkinter import *

class a_customized_window(Tk):
    def __init__(self):
        super().__init__()
        self.title("A custom window")

win=a_customized_window()
win.mainloop()
  • Related