0

The question is simple: i just want to open my FileChooserDialog many times as i want, without re-creating the same widget.

Destroy signal/method is not for me, because i don't want to destroy the reference to the object, i just need to hide the FileChooserDialog

The problem is that, by this code, i just get the dialog with the the buttons, but nothing else (no paths, no files list, no folders..) just the buttons and a grey blank window.

HERE BELOW THE CODE:

self.__file_chooser_dialog = gtk.FileChooserDialog("Open..", None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) def file_chooser_event(self, widget, data=None): self.__file_chooser_dialog.show_all() response = self.__file_chooser_dialog.run() if response == gtk.RESPONSE_OK: print self.__file_chooser_dialog.get_filename(), 'selected' elif response == gtk.RESPONSE_CANCEL: print 'Closed, no files selected' self.__file_chooser_dialog.hide_all() self.__load_config=gtk.Button('Carica file di configurazione\n(nome__file.ini)') self.__load_config.connect('clicked', self.file_chooser_event) 

2 Answers 2

1

You should consider using gtk.Widget::hide_on_delete, which exists for that purpose.

Sign up to request clarification or add additional context in comments.

Comments

0

i've tried multiple ways to let it work.. and you just need to do this edit:

self.__file_chooser_dialog.show_all() -----> self.__file_chooser_dialog.show() self.__file_chooser_dialog.hide_all() -----> self.__file_chooser_dialog.hide() 

Can you explain me why this works?!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.