Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing the Gdk area after import Gtk and closing a window
    primarykey
    data
    text
    <p>I found myself in the situation where I needed to close a window which I had subclassed from <code>Gtk.Window</code>. I was connecting the window.destroy event to close the window initially to <code>Gtk.main_quit</code> for testing, but when I loaded the module into my main program, I couldn't do it that way, of course, without closing the main program. When I wrote a function, I stupidly called the <code>window.destroy()</code> method which, stupid of me, resulted in a max recursion error. So, I decided to connect a 'delete-event' and then call the <code>window.destroy()</code> which still recursed because (as I learned) a destroy event calls delete-event. So, I connected the destroy event to a function and tried to call:</p> <pre><code>window.emit('delete-event') </code></pre> <p>which worked, but resulted in an error wanting another parameter. Researching, I learned it needed to be something like this from gtk2:</p> <pre><code>window.emit("delete-event", gtk.gdk.Event(gtk.gdk.DELETE)) </code></pre> <p>I can't find <code>Gdk</code> under <code>Gtk</code> like I can find <code>gdk</code> under <code>gtk</code>. I don't like this. I imported Gdk and <code>Gdk.Event</code> is found, but no equivalent to the <code>gtk.gdk.DELETE variable</code>. I did a:</p> <pre><code>l = dir(Gdk) for i in l: if 'DELETE' in i: print(i) </code></pre> <p>and came up with no DELETE variable defined in Gdk.</p> <p>How can we access Gdk from Gtk? If not, how do we translate these gtk.gdk... things when they don't exist under Gdk?</p> <p>Ultimately, I just did:</p> <pre><code>del window </code></pre> <p>to do what I needed to do, but I still would like to know how to do the emit signal above in Gtk3 for learning purposes.</p> <p>Thanks,</p> <p>Narnie</p>
    singulars
    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.
 

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