Glade aboutDialog not closing

I have a field AboutDialogmade in a clearing, but the Close button does not work. I do not know how to connect this button to a separate function, since it is in the widget called dialog-action_area.

Another problem is that if I use the close button created by the window manager, I cannot open it again because it was destroyed.

How can I change this to just hide it?

+3
source share
2 answers

You need to call the widget hide () method when you receive delete or cancel signals:

response = self.wTree.get_widget("aboutdialog1").run() # or however you run it
if response == gtk.RESPONSE_DELETE_EVENT or response == gtk.RESPONSE_CANCEL:
  self.wTree.get_widget("aboutdialog1").hide()

In the GTK documentation you can find response type constants

+5
source

,

  • run.

, , , Esc, "" , , wil , , run() . :

response = dialog.run()

, , , . , yout, , .

response = dialog.run()
if response == gtk.RESPONSE_OK:
    #do something here if the user hit the OK button 
dialog.destroy()

, "".

def do_response(dialog, response):
    if response == gtk.RESPONSE_OK:
        #do something here if the user hit the OK button 
    dialog.destroy()

dialog.connect('response', do_response)

,

+6

Source: https://habr.com/ru/post/1703674/


All Articles