Thank all!
I got it now.

On Mon, Mar 19, 2012 at 1:30 AM, Neil Muller <drnlmuller+...@gmail.com> wrote:
> On 19 March 2012 06:02, Zhenjiang Lan <lan.zhenji...@gmail.com> 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
> drnlmul...@gmail.com
>
> I've got a gmail account. Why haven't I become cool?
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to