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

查看:82
本文介绍了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方向展开以填充窗口在此 GUI图片中。如何使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 (默认), c,底部 RIGHT

  • 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天全站免登陆