- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateButton.py
More file actions
Latest commit
21 lines (16 loc) · 513 Bytes
/
Copy pathCreateButton.py
File metadata and controls
21 lines (16 loc) · 513 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
importtkinterastk
fromtkinterimportttk
win=tk.Tk()
win.title("Create a Button and Add to the GUI Window")
# Modify adding a label
aLabel=ttk.Label(win, text="A label")
aLabel.grid(column=0, row=0)
# Button click Event function
defclickMe():
action.configure(text="** I have been clicked! **")
aLabel.configure(foreground="red")
aLabel.configure(text='A Red Label')
# Adding a Button
action=ttk.Button(win, text='Click Me', command=clickMe)
action.grid(column=1,row=0)
win.mainloop()