how to make a gui python code example
Example 1: how to create a tkinter window
#Creating Tkinter Window In Python:
from tkinter import *
new_window = Tk() #Create a window ; spaces should be denoted with underscores ; every window should have a different name
new_window.title("My Python Project") #Name of screen ; name should be the one which you already declared (new_window)
new_window.geometry("200x150") #Resizes the default window size
new_window.configure(bg = "red") #Gives color to the background
new_window.mainloop() #Shows the window on the screen
Example 2: tkinter tutorial
# check this code first.
from tkinter import *
app = Tk()
# The title of the project
app.title("The title of the project")
# The size of the window
app.geometry("400x400")
# Defining a funtion
def c():
# Label
m = Label(app, text="Text")
m.pack()
# Button
l = Button(app, text="The text of the Butoon", command=c)
# Packing the Button
l.pack()
app.mainloop()
# Quick Note :
# When you put a command you should not use parentheses
# l = Button(app, text="The text of the Butoon", command=c)
# l = Button(app, text="The text of the Butoon", command=c())
Example 3: python gui
import tkinter as tk
#Importing the main module
window = tk.Tk()
window.mainloop()
Example 4: how to create tkinter window
import tkinter
master = tkinter.Tk()
master.mainloop()