Delete event for a FileChooserDialog

i'd like to hide a FileChooserDialog when i delete its window. I can just hide it from the the 'Cancel' Button but when i close it from its window it doen't respond and then it crashes.

View the crash here

The crash happens when i do this, in sequence:

  • I open it (it works fine)

  • I try to close it from the window 'X' button: the buttons 'OK' and 'CANCEL' disappear and FileFilter too

  • I re-try to close it. Now the window become white: it seems it doesn't respond.
  • I re-try to close it. It is closed.
  • I try to re-open the FileChooserDialog just closed. It doesn't work anymore and the shell now tells me what it's wrong.

My code is simple:

self.__apri_FileChooserDialog = Gtk.FileChooserDialog(title='', \
                                                                parent=None, \
                                                                action=Gtk.FileChooserAction.OPEN, \
                                                                buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, \
                                                                Gtk.STOCK_OPEN, Gtk.ResponseType.OK))

self.__salva_FileChooserDialog.connect("delete-event", self.nascondi)

def nascondi(self, widget, args=()):


def nascondi(self, widget, args=()):

For some reason you get the GdkWindow of the dialog widget here, and try to call a method that GdkWindow does not have. That cannot work...

In any case hide_on_delete() is, as far as I know, a bit useless in python (because the number of arguments does not match the signal). Fortunately doing it yourself is not difficult. Try this:

def on_delete_event (widget, event):
    return True


Need Your Help

Newb PHP mail form not working

php html forms email

I'm sure this is a very basic answer and that I'm overlooking something obvious.

Download a .csv file with Python

windows excel csv python-3.x beautifulsoup

I am using Python 3.3 on Windows. I am trying to figure out how to download a .csv file from yahoo finance. It is a file for the Historical Prices.