-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex5.py
More file actions
55 lines (37 loc) · 1.53 KB
/
Copy pathex5.py
File metadata and controls
55 lines (37 loc) · 1.53 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import tkinter as tk
window = tk.Tk()
# Exercise in learning how pack() places things
# Part a
frame1 = tk.Frame(master=window, width=100, height=100, bg="red")
#frame1.pack()
frame2 = tk.Frame(master=window, width=50, height=50, bg="yellow")
#frame2.pack()
frame3 = tk.Frame(master=window, width=25, height=25, bg="blue")
#frame3.pack()
#--------------------------------------------------------------------
# Exercise in manipulating frames with pack()
# Part b
# Fill in the x direction; will strecth frame to fill empty spaces
# Will do this dynamically if window dimensions are changed via dragging
# frame1.pack(fill=tk.X)
# frame2.pack(fill=tk.X)
# frame3.pack(fill=tk.X)
#---------------------------------------
# Exercise in manipulating frames with pack()
# Part c
# Places frames to the left like Bey and fills in the Y direction like Kyoshi
# This means they're stacked left to right, not vertically
# frame1.pack(fill=tk.Y, side=tk.LEFT)
# frame2.pack(fill=tk.Y, side=tk.LEFT)
# frame3.pack(fill=tk.Y, side=tk.LEFT)
#---------------------------------------
# Exercise in manipulating frames with pack()
# Part d
# Making each frame have fixed dimensions AND responsive to window changes
frame1 = tk.Frame(master=window, width=200, height=100, bg="red")
frame1.pack(fill=tk.BOTH, side=tk.LEFT, expand=True)
frame2 = tk.Frame(master=window, width=100, bg="yellow")
frame2.pack(fill=tk.BOTH, side=tk.LEFT, expand=True)
frame3 = tk.Frame(master=window, width=50, bg="blue")
frame3.pack(fill=tk.BOTH, side=tk.LEFT, expand=True)
window.mainloop()