-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path055.Tkinter.py
68 lines (61 loc) · 2.07 KB
/
055.Tkinter.py
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
56
57
58
59
60
61
62
63
64
65
66
67
68
import tkinter
# print(tkinter.TkVersion)
# print(tkinter.TclVersion)
#tkinter._test()
#Pack Geomtery Manager
# mainWindow = tkinter.Tk()
# mainWindow.title("Hello World")
# mainWindow.geometry('640x480+8+400')
#
# label = tkinter.Label(mainWindow,text="Hello World")
# label.pack(side='top')
#
# leftFrame = tkinter.Frame(mainWindow)
# leftFrame.pack(side='left',anchor='n',fill=tkinter.Y,expand=False)
#
# canvas = tkinter.Canvas(leftFrame,relief='raised',borderwidth=1)
# canvas.pack(side='left',fill=tkinter.X,expand=True)
# canvas.pack(side='top',fill=tkinter.Y,expand=True)
# canvas.pack(side='left',fill=tkinter.BOTH,expand=True)
# canvas.pack(side='left',anchor='n')
#
# rightFrame = tkinter.Frame(mainWindow)
# rightFrame.pack(side='right',anchor='n',expand=True)
#
# button1 = tkinter.Button(rightFrame,text='Button1')
# button2 = tkinter.Button(rightFrame,text='Button2')
# button3 = tkinter.Button(rightFrame,text='Button3')
# button1.pack(side='top')
# button2.pack(side='top')
# button3.pack(side='top')
#
# mainWindow.mainloop()
#Grid Geomerty Manager
mainWindow = tkinter.Tk()
mainWindow.title("Hello World")
mainWindow.geometry('640x480-8-200')
label = tkinter.Label(mainWindow,text="Hello World")
label.grid(row=0,column=0)
leftFrame = tkinter.Frame(mainWindow)
leftFrame.grid(row=1,column=1)
canvas = tkinter.Canvas(leftFrame,relief='raised',borderwidth=1)
canvas.grid(row=1,column=0)
rightFrame = tkinter.Frame(mainWindow)
rightFrame.grid(row=1,column=2,sticky='n')
button1 = tkinter.Button(rightFrame,text='Button1')
button2 = tkinter.Button(rightFrame,text='Button2')
button3 = tkinter.Button(rightFrame,text='Button3')
button1.grid(row=0,column=0)
button2.grid(row=1,column=0)
button3.grid(row=2,column=0)
#configure the column
mainWindow.columnconfigure(0,weight=1)
mainWindow.columnconfigure(1,weight=1)
mainWindow.grid_columnconfigure(2,weight=1)
leftFrame.config(relief='sunken',borderwidth=1)
rightFrame.config(relief='sunken',borderwidth=1)
leftFrame.grid(sticky='ns')
rightFrame.grid(sticky='new')
rightFrame.columnconfigure(0,weight=1)
button2.grid(sticky='ew')
mainWindow.mainloop()