Answers for "how to create window in tkinter python"

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
1

tkinter window

from tkinter import *

root = Tk()
root.geometry("500x500")
root.title("My App")
root.config(bg="#ff0000")

def printhi(*args):
	print("Hi!")
    
btn = Button(root, text="Click to print hi", command=printhi)
btn.place(x=200, y=200)

root.mainloop()
Posted by: Guest on August-05-2021

Code answers related to "how to create window in tkinter python"

Python Answers by Framework

Browse Popular Code Answers by Language