-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtk_2.py
More file actions
35 lines (23 loc) · 716 Bytes
/
Copy pathtk_2.py
File metadata and controls
35 lines (23 loc) · 716 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
31
32
33
34
35
import tkinter
class App:
def __init__(self, master):
frame = tkinter.Frame(master)
frame.pack()
self.button = tkinter.Button(
frame, text='QUIT', fg='red', command=frame.quit
)
self.button.pack(side=tkinter.RIGHT)
self.hi_there = tkinter.Button(frame, text='Hello', command=self.say_hi)
self.hi_there.pack(side=tkinter.LEFT)
self.oi = tkinter.Button(frame, text='oi', command=self.oi_noise)
self.oi.pack(side=tkinter.RIGHT)
@staticmethod
def say_hi():
print('hi there')
@staticmethod
def oi_noise():
print('noise!')
root = tkinter.Tk()
app = App(root)
root.mainloop()
root.destroy()