免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5271 | 回复: 2
打印 上一主题 下一主题

tkinter中的columnconfigure()是做什么的? [复制链接]

论坛徽章:
1
程序设计版块每日发帖之星
日期:2015-11-25 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-11-11 18:14 |只看该作者 |倒序浏览
  1. root=tkinter.Tk()
  2. root.columnconfigure(0,weight=1) # 作用是什么
  3. root.rowconfigure(0,weight=1)
  4. ftm = ttk.Frame(root)
  5. ftm.rowconfigure(0,weight=1)
  6. # 指第0行(列),宽为1吗?
复制代码

论坛徽章:
16
CU十二周年纪念徽章
日期:2013-10-24 15:41:3415-16赛季CBA联赛之广东
日期:2015-12-23 21:21:55青铜圣斗士
日期:2015-12-05 10:35:30黄金圣斗士
日期:2015-11-26 20:42:16神斗士
日期:2015-11-19 12:47:50每日论坛发贴之星
日期:2015-11-18 06:20:00程序设计版块每日发帖之星
日期:2015-11-18 06:20:002015亚冠之城南
日期:2015-11-10 19:10:492015亚冠之萨济拖拉机
日期:2015-10-28 18:47:282015亚冠之柏太阳神
日期:2015-08-30 17:21:492015亚冠之山东鲁能
日期:2015-07-07 18:48:39摩羯座
日期:2014-08-29 23:01:42
2 [报告]
发表于 2015-11-11 20:49 |只看该作者
Handling Resize
If you've taken a peek below and added the extra "sticky" options to our example, when you try it out you'll notice things still don't look quite right (the entry is lower on the screen then we'd want), and things are even worse if you try to resize the window — nothing moves at all!

It looks like "sticky" may tell Tk how to react if the cell's row or column does resize, but doesn't actually say that the row or columns should resize if extra room becomes available. Let's fix that.

Every column and row has a "weight" grid option associated with it, which tells it how much it should grow if there is extra room in the master to fill. By default, the weight of each column or row is 0, meaning don't expand to fill space.

For the user interface to resize then, we'll need to give a positive weight to the columns we'd like to expand. This is done using the "columnconfigure" and "rowconfigure" methods of grid. If two columns have the same weight, they'll expand at the same rate; if one has a weight of 1, another of 3, the latter one will expand three pixels for every one pixel added to the first.

Both "columnconfigure" and "rowconfigure" also take a "minsize" grid option, which specifies a minimum size which you really don't want the column or row to shrink beyond.


More information refer to http://www.tkdocs.com/tutorial/grid.html#colsrows

论坛徽章:
1
程序设计版块每日发帖之星
日期:2015-11-25 06:20:00
3 [报告]
发表于 2015-11-18 18:55 |只看该作者
百度翻译看得似是而非
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP