-
Notifications
You must be signed in to change notification settings - Fork 0
/
button.py
32 lines (22 loc) · 858 Bytes
/
button.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from tkinter import *
root = Tk()
myButton = Button(root, text="You cant click me!", state=DISABLED)
myButton.pack()
myButton2 = Button(root, text="Wide Button!", padx=50)
myButton2.pack()
myButton3 = Button(root, text="Tall Button!", pady=50)
myButton3.pack()
myButton4 = Button(root, text="Big Button!", padx=50, pady=50)
myButton4.pack()
def myClick():
myLabel = Label(root, text="I did a thing!")
myLabel.pack()
# If command=myClick --> command=myClick()
# then myClick would be executed immediatly without clicking
myButton5 = Button(root, text="This button actually does something :)", command=myClick)
myButton5.pack()
myButton6 = Button(root, text="Simple Colored Button!", fg="white", bg="black")
myButton6.pack()
myButton6 = Button(root, text="Hex Colored Button!", fg="#000000", bg="#ff9500")
myButton6.pack()
root.mainloop()