简体   繁体   English

python3.3 tkinter ttk'填充'

[英]python3.3 tkinter ttk 'padding'

The padding option for widgets can be set like this: 小部件的padding选项可以这样设置:

frm = ttk.Frame(padding = "5 5 10 10")

I'd like to examine and change this during program execution, and have written this: 我想在程序执行过程中进行检查和更改,并编写了以下代码:

if frm['padding'] == "5 5 10 10":
    do something

The problem is, "5 5 10 10" is not returned! 问题是,未返回“ 5 5 10 10”! I get pixel object at 0x1d753f0, etc. As the memory location changes with every time the program runs, this is of no use to me. 我在0x1d753f0等处获得了像素对象,等等。随着程序每次运行时内存位置的变化,这对我没有用。 How can I get a usable response? 如何获得可用的回复?

frm['padding'] returns a tuple of pixel objects. frm['padding']返回一个像素对象元组。 You can get each pixel object value via its string attribute: 您可以通过其string属性获取每个像素对象的值:

for po in f['padding']: 
    print po.string

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM