Tkinter Pack 几何管理器 - 选项 [英] The Tkinter Pack Geometry Manager - options

查看:28
本文介绍了Tkinter Pack 几何管理器 - 选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在自学 TKINTER.我已经写...

I am teaching myself TKINTER at the moment. I have written...

self.frameBottom = tk.Frame(master)
self.frameBottom.pack(side=tk.BOTTOM, fill=tk.BOTH)

self.textBox = tk.Text(master, height=1)
self.textBox.pack(side = tk.LEFT, expand=1, fill=tk.X)

self.searchButton = tk.Button(master, text="Search",  command=self.searchButtonPress)
self.searchButton.pack(side = tk.RIGHT)

self.textBoxResults = tk.Text(self.frameBottom)
self.textBoxResults.pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1)

然而,在这个 图形界面.我怎样才能让 textBoxResults 在 Y 方向扩展,并将 textBox 和 searchButton 保持在顶部?

however the lower textBoxResults does not expand in the Y direction to fill the window as can be seen in this GUI picture. How can I make the textBoxResults expand in the Y direction, and keep the textBox and searchButton attached to the top please?

TIA

推荐答案

这是一个社区维基答案,欢迎添加相关内容!

Python 教程 - 25.1.6.3.封隔器选项

  • side=
    指定要针对哪一侧打包小部件:TOP(默认)、LEFTBOTTOMRIGHT
  • expand=
    布尔值,0 或 1.
  • fill=
    合法值:'x''y''both''none'.
  • ipadx=
    内部填充.
  • side=
    Specifies which side to pack the widget against: TOP (default), LEFT, BOTTOM and RIGHT
  • expand=
    Boolean, 0 or 1.
  • fill=
    Legal values: 'x', 'y', 'both', 'none'.
  • ipadx=
    Internal padding.

Tkinter Pack 几何管理器

Pack 几何管理器将小部件打包成行或列.您可以使用填充、展开和侧边等选项来控制此几何管理器.

The Pack geometry manager packs widgets in rows or columns. You can use options like fill, expand, and side to control this geometry manager.

这篇关于Tkinter Pack 几何管理器 - 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆