简体   繁体   English

pyGTK:打包和打开包装

[英]pyGTK : pack and unpack

Can I use pack once the main loop has been showed, or should I use something else to add /remove widgets to /from a vbox afterwards ? 我可以在主循环显示后使用pack,还是应该使用其他东西在vbox之后添加/删除小部件?

I have this gtk.Window() that contains a vbox , where a menu , a treeview and a button are pack ed. 我有这个gtk.Window()它包含一个vbox ,其中一个menu ,一个treeview和一个buttonpack版。 At the push of this button, I want to display an image in a new container inside this window / vbox, and ideally, close said container at will. 按下此按钮,我想在此窗口/ vbox内的新容器中显示图像,理想情况下,随意关闭所述容器。

(think image viewer with a file list, you click on an image file and a pane opens displaying it, if you click on another image file the new image is displayed in place of the old, and you can close the image pane) (想想带有文件列表的图像查看器,单击图像文件并打开一个窗格显示它,如果单击另一个图像文件,则显示新图像代替旧图像,并且可以关闭图像窗格)

My question is : How do you do that ? 我的问题是:你是怎么做到的? My trials so far led me to believe that once the vbox has been show() 'd, you cant pack anything else into it..? 到目前为止,我的试验让我相信,一旦vbox已经show() ,你就无法pack任何其他内容pack进去......? Has the "image" container have to exist prior to being displayed...? 在显示之前,“图像”容器是否必须存在?

What is the proper process to do this, in witch direction of the GTK manual should I look? 这样做的正确过程是什么,我应该看看GTK手册的女巫方向?

In GTK+ all widgets are hidden by default (which I think was a stupid design decision, but oh well). 在GTK +中默认隐藏所有小部件(我认为这是一个愚蠢的设计决定,但是很好)。 You usually call show_all() on a window, so indirectly show all widgets contained in it by the time of the call . 您通常在窗口上调用show_all() ,因此在调用时间接显示其中包含的所有小部件。 If you add (pack, whatever) a widget later, don't forget to show() it manually. 如果您稍后添加(包装,无论如何)小部件,请不要忘记手动show()

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

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