how to create a python class in tkinter

Solutions on MaxInterview for how to create a python class in tkinter by the best coders in the world

showing results for - "how to create a python class in tkinter"
Filippo
12 Jul 2019
1# Import
2from tkinter import *
3# Class Section
4class Window(object):
5  def __init__(self):
6    self.tk = Tk()
7    self.tk.title("Demo Window")
8    self.tk.geometry("500x500")
9    self.tk.resizable(0, 0)
10    self.tk.mainloop()
11    self.widgets()
12    pass
13  def widgets(self):
14    lbl = Label(self.tk, text="Hello")
15    lbl.pack()
16    pass
17win = Window()