Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9091883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:42:57+00:00 2026-06-16T22:42:57+00:00

I found myself in the situation where I needed to close a window which

  • 0

I found myself in the situation where I needed to close a window which I had subclassed from Gtk.Window. I was connecting the window.destroy event to close the window initially to Gtk.main_quit 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 window.destroy() method which, stupid of me, resulted in a max recursion error. So, I decided to connect a ‘delete-event’ and then call the window.destroy() 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:

window.emit('delete-event')

which worked, but resulted in an error wanting another parameter. Researching, I learned it needed to be something like this from gtk2:

window.emit("delete-event", gtk.gdk.Event(gtk.gdk.DELETE))

I can’t find Gdk under Gtk like I can find gdk under gtk. I don’t like this. I imported Gdk and Gdk.Event is found, but no equivalent to the gtk.gdk.DELETE variable. I did a:

l = dir(Gdk)
for i in l:
    if 'DELETE' in i:
        print(i)

and came up with no DELETE variable defined in Gdk.

How can we access Gdk from Gtk? If not, how do we translate these gtk.gdk… things when they don’t exist under Gdk?

Ultimately, I just did:

del window

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.

Thanks,

Narnie

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:42:58+00:00Added an answer on June 16, 2026 at 10:42 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Due to lack of planning I found myself in a situation where I had
I've found myself in a situation, that makes me ask for help. I've got
I've found myself evaluating both of these libs. Apart from what the GraphicsMagick comparison
I know what they all do, but have never found myself in a situation
I've found myself twice in this situation: I install a gem on my system
I had a serious bug in my code, which luckily I found :), because
This is not the first time that I've found myself in a situation in
I'm working on a project and have found myself in a situation where I
long time reader, first time question-er. I've found myself in a unique situation, and
I found myself in a situation where I know what type something is. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.