Python Tkinter Window, Button and Label project


from tkinter import *                       #import tkinter library
root = Tk() #instance tkinger frame
root.title("Python Window") #add title
root.geometry("600x300+660+86") #Size & Position of window
root.resizable(width="true", height="true") # Window resize

def clickme(): #Use of function
root2 = Tk()
root2.geometry("700x300") #new tkinter window create
root2.config(bg="#C0FF3E")
lbl=Label(root2, text="Hello, How are you", font=("Times new roman", 30, "bold"),
bg="#C0FF3E", foreground="red")
lbl.pack(pady=60) #label is created and set to root2 window

btn = Button(root, text="Click Me", width=20, height=2,border=8, background="#FF7F24",
font=("Times", 18, "bold"), command=clickme) #button created
btn.pack(pady=70) # button pack
root.mainloop()

Write Down the  Code Your Pycharm/ Code Editor. Press Shift+F10 and Show Your Output.





Post a Comment

أحدث أقدم