Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

window in python

#We will use tkinter for now
from tkinter import *
import tkinter as tk
#After importing tkinter we can give any name to our window for storing it
screen = Tk()
#Now we can add title to window using .title()
screen.title("VScoder tutorial how to create a window")
#You may set a size
screen.geometory("400x600")
#For now we will add a label and later you may add other items
Firstlabel = Label(screen, text="Hi")
#We may config and change background and text color or foreground
Firstlabel.config(bg="Red", fg="Blue")
#We can pack it or grid it , for now I will pack it ,Grid is for a special 
#location
Firstlabel.pack()
#Now to add it create a mainloop
screen.mainloop()
 
PREVIOUS NEXT
Tagged: #window #python
ADD COMMENT
Topic
Name
3+9 =