-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpack_grid.py
More file actions
35 lines (23 loc) · 783 Bytes
/
pack_grid.py
File metadata and controls
35 lines (23 loc) · 783 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
from tkinter import *
root = Tk()
root.title("Pack vs. Grid - Intro To Tkinter")
root.iconbitmap('images/tkinter.ico')
root.geometry('500x350')
# Pack some buttons
my_button1 = Button(root, text="Button")
my_button2 = Button(root, text="Button")
my_button1.pack(pady=(20,0))
my_button2.pack(pady=0, fill=X, padx=20)
# Create a quick frame
my_frame = Frame(root)
my_frame.pack(pady=50)
# Grid Stuff
my_button3 = Button(my_frame, text="Button")
my_button4 = Button(my_frame, text="Button")
my_button5 = Button(my_frame, text="Button")
my_button6 = Button(my_frame, text="Button")
my_button3.grid(row=0, column=0)
my_button4.grid(row=0, column=1, padx=20)
my_button5.grid(row=0, column=2)
my_button6.grid(row=1, column=0, pady=20, columnspan=3, sticky='ew')
root.mainloop()