inialize tkinter window code example
Example 1: how to make a tkinter window
from tkinter import *
mywindow = Tk()
mywindow.title("New Project")
mywindow.geometry("780x640")
mywindow.minsize(540, 420)
mywindow.configure(bg="blue")
mywindow.mainloop()
Example 2: root = tk.Tk() my_gui = App1(root)
from tkinter import Label, Button
blink = 0
class MyClass(tk.Frame):
def __init__(self, master):
self.master = master
super().__init__(self.master)
global blink
self.label = Label(master, text=blink)
self.button = Button(master, text="Button", command=lambda: foo(self.label))
self.label.pack()
self.button.pack()
def blinkCheck(self):
global blink
while True:
print("blink in blinkCheck method is = {}".format(blink))
time.sleep(2.5)
def foo(self, label):
label.config(text=blink)