There is no gtk.gdk
in GTK 3, all of that functionality, or its equivalent, must be available using from gi.repository import Gdk
. The previous gtk.gdk
hierarchy was actually for convenience, but didn't make any sense because GDK is a completely independent package and is not part of GTK. The new organization makes more sense because the hierarchy and variable names are exactly the same as in the C, Javascript, etc. APIs.
In this case, gtk.gdk.DELETE
is available as Gdk.EventType.DELETE
, so you should be able to do
window.emit('delete-event', Gdk.Event(Gdk.EventType.DELETE))
However, you are not supposed to emit event signals yourself, so it would be better to do:
window.event(Gdk.Event(Gdk.EventType.DELETE))
Or even better, don't connect to the event at all in your module. Then you can use window.destroy()
without a recursion error. Connect to the destroy signal in your main program, then you can simply call Gtk.main_quit
.