Note that there are some explanatory texts on larger screens.

plurals
  1. POWindow does not display properly
    primarykey
    data
    text
    <p>I have a little problem that I can't solve concerning windows constructed with gtk:</p> <p>In my program, I have two functions that display a separate gtk.window with content in it (one with a button -displaying a text-, the other with a key press event -displaying a matplotlib figure-). On the first run of the program, the two windows display properly with the contents I asked for, but when I close the separate window and try to display it again I obtain an empty window (in both cases) and I can't figure out why!</p> <p>If you have some suggestions, I will be glad to read them (I'll work on a little version of my program to test it and add it to the post later).</p> <p>Thanks!</p> <p>EDIT: Here's the sample I tested, and I think that the same problem occur, the glade file is nothing much (one window and two buttons), but when I click on one of the buttons, the first time the window is normal and when I close and reopen I have the same problem as in my real program.</p> <pre><code>import gtk import gtk.glade class Testwin: # Initialisation of window and connection of signals def __init__(self): self.Main = gtk.Builder() self.Main.add_from_file('Testwin.glade') self.Mainwindow = self.Main.get_object("Main_window") self.Main.connect_signals(self) self.extWindow1 = self.Main.get_object("External_window1") self.extWindow2 = self.Main.get_object("External_window2") def on_window_destroy(self, widget): gtk.main_quit() def display_window1(self, widget): self.extWindow1.show_all() def display_window2(self, widget): self.extWindow2.show_all() if __name__ == "__main__": Testwin() gtk.main() </code></pre> <p>(I put the .glade file as well in case someone wants to test it)</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;interface&gt; &lt;requires lib="gtk+" version="2.24"/&gt; &lt;!-- interface-naming-policy project-wide --&gt; &lt;object class="GtkWindow" id="External_window1"&gt; &lt;property name="can_focus"&gt;False&lt;/property&gt; &lt;child&gt; &lt;placeholder/&gt; &lt;/child&gt; &lt;/object&gt; &lt;object class="GtkWindow" id="External_window2"&gt; &lt;property name="can_focus"&gt;False&lt;/property&gt; &lt;child&gt; &lt;placeholder/&gt; &lt;/child&gt; &lt;/object&gt; &lt;object class="GtkWindow" id="Main_window"&gt; &lt;property name="visible"&gt;True&lt;/property&gt; &lt;property name="can_focus"&gt;False&lt;/property&gt; &lt;signal name="destroy" handler="on_window_destroy" swapped="no"/&gt; &lt;child&gt; &lt;object class="GtkHButtonBox" id="hbuttonbox1"&gt; &lt;property name="visible"&gt;True&lt;/property&gt; &lt;property name="can_focus"&gt;False&lt;/property&gt; &lt;child&gt; &lt;object class="GtkButton" id="button1"&gt; &lt;property name="label" translatable="yes"&gt;button&lt;/property&gt; &lt;property name="visible"&gt;True&lt;/property&gt; &lt;property name="can_focus"&gt;True&lt;/property&gt; &lt;property name="receives_default"&gt;True&lt;/property&gt; &lt;signal name="clicked" handler="display_window2" swapped="no"/&gt; &lt;/object&gt; &lt;packing&gt; &lt;property name="expand"&gt;False&lt;/property&gt; &lt;property name="fill"&gt;False&lt;/property&gt; &lt;property name="position"&gt;0&lt;/property&gt; &lt;/packing&gt; &lt;/child&gt; &lt;child&gt; &lt;object class="GtkButton" id="button2"&gt; &lt;property name="label" translatable="yes"&gt;button&lt;/property&gt; &lt;property name="visible"&gt;True&lt;/property&gt; &lt;property name="can_focus"&gt;True&lt;/property&gt; &lt;property name="receives_default"&gt;True&lt;/property&gt; &lt;signal name="clicked" handler="display_window1" swapped="no"/&gt; &lt;/object&gt; &lt;packing&gt; &lt;property name="expand"&gt;False&lt;/property&gt; &lt;property name="fill"&gt;False&lt;/property&gt; &lt;property name="position"&gt;1&lt;/property&gt; &lt;/packing&gt; &lt;/child&gt; &lt;/object&gt; &lt;/child&gt; &lt;/object&gt; &lt;/interface&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload