-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.py
More file actions
30 lines (24 loc) · 689 Bytes
/
Button.py
File metadata and controls
30 lines (24 loc) · 689 Bytes
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
from tkinter import *
# button = you click it, then it does stuff
count = 0
def click():
global count
count += 1
print("You clicked the button!", count, " times")
window = Tk()
photo = PhotoImage(file='image.png')
button = Button(window,
text="Click me!",
command=click,
font=("comic sans", 30),
fg="green",
bg="black",
bd=2.1,
activeforeground="green",
activebackground="black",
state=ACTIVE,
image=photo,
compound='bottom')
window.config(background="sky blue")
button.pack()
window.mainloop()