-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathframes.py
More file actions
34 lines (24 loc) · 870 Bytes
/
frames.py
File metadata and controls
34 lines (24 loc) · 870 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
import tkinter as tk
class Root(tk.Tk):
def __init__(self):
super().__init__()
self.title('Frames')
self.geometry('400x300')
self.frame = tk.Frame()
self.frame.pack(expand=True)
self.label = tk.Label(self.frame, text='Click the button', pady=10)
self.label.pack()
self.button = tk.Button(self.frame, text='Click this',
command=self.button_click)
self.button.pack(side=tk.LEFT)
self.quit = tk.Button(self.frame, text='Quit',
command=self.quit_program)
self.quit.pack(side=tk.RIGHT)
def button_click(self):
self.label['text'] = 'Button clicked!'
self.label['fg'] = 'blue'
def quit_program(self):
self.destroy()
if __name__ == '__main__':
root = Root()
root.mainloop()