发布时间:2019-07-30 10:53:44编辑:auto阅读(1725)
This geometry manager organizes widgets in blocks before placing them in the parent widget.
widget.pack( pack_options ) |
Here is the list of possible options:
expand: When set to true, widget expands to fill any space not otherwise used in widget's parent.
fill: Determines whether widget fills any extra space allocated to it by the packer, or keeps its own minimal dimensions: NONE (default), X (fill only horizontally), Y (fill only vertically), or BOTH (fill both horizontally and vertically).
side: Determines which side of the parent widget packs against: TOP (default), BOTTOM, LEFT, or RIGHT.
Try following example by moving cursor on different buttons:
from Tkinter import * root = Tk() frame = Frame(root) frame.pack() bottomframe = Frame(root) bottomframe.pack( side = BOTTOM ) redbutton = Button(frame, text="Red", fg="red") redbutton.pack( side = LEFT) greenbutton = Button(frame, text="Brown", fg="brown") greenbutton.pack( side = LEFT ) bluebutton = Button(frame, text="Blue", fg="blue") bluebutton.pack( side = LEFT ) blackbutton = Button(bottomframe, text="Black", fg="black") blackbutton.pack( side = BOTTOM) root.mainloop() |
上一篇: Python 14.2 TCP编程
下一篇: python 中目录、文件
47491
45793
36791
34322
28959
25596
24442
19609
19110
17631
5464°
6047°
5569°
5637°
6572°
5375°
5377°
5883°
5854°
7169°