开发者

Reopened PyGtk window is empty

开发者 https://www.devze.com 2023-03-27 20:29 出处:网络
I am working with Glade to make a simple GUI application using PyGTK. I have two windows, one only showing up when a button i开发者_开发技巧s pressed.

I am working with Glade to make a simple GUI application using PyGTK. I have two windows, one only showing up when a button i开发者_开发技巧s pressed.

    def on_preview_clicked(self, widget):
           print "You clicked the Preview button"
           prev = self.builder.get_object("previewWindow")
           prev.show()

The window is working fine, but if I close it, and try to open it again, it becomes empty. I found on google that it may be because the window I am referring to was "destroyed", so I made the window hide instead.

    def hide_preview(self, widget):
            print "Hide it!"
            prev = self.builder.get_object("previewWindow")
            prev.hide()
            return True

This did nothing, the window still comes up empty the second time around. What am I missing?


Without a working testcase of this, it's difficult to be sure, but try changing it from show() to show_all(), to be sure that all the child widgets of the window are shown as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消