关注开源技术(黑龙江。哈尔滨) 倡导企业级开源应用,探索信息化方案标准; 集成开源众多新成果,消除开源方案忧与患; 力推低成本开源战车,笑纳八方来客叙开源; 普及开源知识助推力,喜迎开源企业展宏图;

Layout management(Tkinter)布局管理

上一篇 / 下一篇  2007-12-28 06:01:15 / 个人分类:开源开发类

GUI application
widgets get arranged in a window?
Although there are three different “geometry managers” in Tkinter, the author strongly
prefers the Grid geometry manager for pretty much everything. This manager treats every window or frame as a table—a gridwork of rows and columns.
A cell is the area at the intersection of one row and one column.
The width of each column is the width of the widest cell in that column.
The height of each row is the height of the largest cell in that row.
For widgets that do not fill the entire cell, you can specify what happens to the extra
space. You can either leave the extra space outside the widget, or stretch the widget
to fit it, in either the horizontal or vertical dimension.
You can combine multiple cells into one larger area, a process called spanning.
When you create a widget, it does not appear until you register it with a geometry
manager. Hence, construction and placing of a widget is a two-step process that goes
something like this:
        thing = Constructor(master, ...)
        thing.grid(...)
where Constructor is one of the widget classes like Button, Frame, and so on. All
widgets have a .grid() method that you can use to tell the geometry manager where to
put it.


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar