Specific GTK Event

I am showing the user a popup menu when they right click.

As per the popup behavior, I want to destroy the popup when it loses focus (when the user clicks outside of the popup). For this, I tried to hook up the popup to " focus-out-event " using Glade. But for some reason this event is not fired. I tried to print something to the terminal when the event is fired but nothing is printed.

I'm new to Python and GTK and now I don't know how to proceed further.

#handler to catch the focus out event
def on_popup_menu_add_attachment_focus_out_event(self, *args):
    print("Destroying the popup.....")

      

focus-exit and its handler enter image description here

+3


source to share


1 answer


I just changed the type as top level and it works!



+2


source







All Articles