On 19 March 2012 06:02, Zhenjiang Lan <[email protected]> wrote: > Hi all experts, > I create a button, connect to a FileChooserDialog. When I click the > button, I can choose a file and print it's name. > But, if I click 'cancel' for the first time, then I click the button > again, it crashed..
You have dialog as a class attribute on your choosefile class, so it's only instantiated once. Since you call dialog.destroy() in the run method, and then try to rerun the dialog, the crash is not surprising. There are a couple of ways to fix this. I'd explicitly make choosefile a singleton and use dialog.hide(), but you could also make it an instance variable (by creating in choosefile's __init__ method) and thus recreate the file chooser on each run. -- Neil Muller [email protected] I've got a gmail account. Why haven't I become cool? _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
