Skip to content
Sign upLog in
← Back to Community

nouf

Profile icon
NOUFAHMED1

Author Name : nouf

Date: 18 may

Description : Creating new Widgets (Labels and Buttons)

#Import tkinter library
from tkinter import *

Creating new window

window=Tk()
window.title("My new pro")
window.geometry("300x500")

Creating Label 1

lbl1=Label(window, text="Welcome", bg='red', fg='white')
lbl1.grid(row=0 ,column=0) # Label 1 Position

Creating Label 2

lbl2=Label(window, text="Not clicked", bg ='Orange',fg='white')
lbl2.grid(row=1 ,column=0) # Label 2 Position

Action for Button

def Button_Click():
lbl2.configure(text="You Clicked me", bg='Green')

Creating Button

btn=Button(window, text="Click Here", command=Button_Click)
btn.grid(row=2 ,column=0) # Button Position

window.mainloop()

Voters
Profile icon
NOUFAHMED1
Comments
hotnewtop
Profile icon
gregory54

Hello, this weekend is good for me, since now i'm scanning this enormous informative article only at my home. spring loaded chute discharge door

Profile icon
gregory54

Thanks for making the effort to discuss this, I feel strongly about any of it and love learning more with this topic. If possible, as you gain expertise, could you mind updating your blog with extra information? It is extremely great for me. เว็บพนันออนไลน์