Answers for "inialize tkinter window"

6

how to make a tkinter window

from tkinter import *

mywindow = Tk() #Change the name for every window you make
mywindow.title("New Project") #This will be the window title
mywindow.geometry("780x640") #This will be the window size (str)
mywindow.minsize(540, 420) #This will be set a limit for the window's minimum size (int)
mywindow.configure(bg="blue") #This will be the background color

mywindow.mainloop() #You must add this at the end to show the window
Posted by: Guest on September-25-2020
0

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()
        #self.blinkCheck()

    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)
Posted by: Guest on September-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language