Splashscreen + Dialog + Validator Problem

Hi all,

I was trying to add a Splashscreen and a Dialog to my app. I got it all to work and was pleased when I found that Validator could help me pass data to my Frame and Panel but at the end when I tried to close the app it just hung. There were no diagnostics or errors in my demo.log file to help me. Attached is a version which reproduces the problem. Before adding the Dialog, I think it worked fine. Anybody know why it hangs?

RLRandallx

sample.py (8.15 KB)

Hi all,

I was trying to add a Splashscreen and a Dialog to my app. I got it all to work and was pleased when I found that Validator could help me pass data to my Frame and Panel but at the end when I tried to close the app it just hung. There were no diagnostics or errors in my demo.log file to help me. Attached is a version which reproduces the problem. Before adding the Dialog, I think it worked fine. Anybody know why it hangs?

RLRandallx

Hi Robin,

I can’t try running your sample due to the lack of ISO to import but in general I would say your problem is likely to be a result of using the dlg.Destroy() when you have a global inside the dialogs init , try commenting it out. I would also try to remove as many as possible of the global statements, in general these should be used sparingly, it is always better to pass data in/back than to use global values. If you mix global and Destroy there is always a risk that you might have something that accesses the global after it is destroyed.

Steve

···

From: Robin Randall

Sent: Sunday, January 24, 2010 1:26 AM

To: wxpython-users@googlegroups.com

Subject: [wxPython-users] Splashscreen + Dialog + Validator Problem

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Run into the same problem as Steve, i.e. I can't run your code due to dependencies.

http://wiki.wxpython.org/MakingSampleApps

Werner

···

On 24/01/2010 02:26, Robin Randall wrote:

Hi all,
I was trying to add a Splashscreen and a Dialog to my app. I got it all to work and was pleased when I found that Validator could help me pass data to my Frame and Panel but at the end when I tried to close the app it just hung. There were no diagnostics or errors in my demo.log file to help me. Attached is a version which reproduces the problem. Before adding the Dialog, I think it worked fine. Anybody know why it hangs?

Is this the part you are talking about?

     def OnExit(self, evt):
         self.Hide()
         global iso
         frame = MyFrame(None, -1,"Sample",wx.DefaultPosition, (640, 750))
         app.SetTopWindow(frame)
         frame.Show(True)
         # The program will freeze without this line.
         evt.Skip() # Make sure the default handler runs too...

If so then that is actually sort of a feature. The MainLoop does not exit as long as there is any top-level window that still exists, and the wx.SplashScreen derives from wx.Frame so it is a top-level window. When you don't call Skip from an EVT_CLOSE handler then the default EVT_CLOSE handler does not run and so the window does not destroy itself, causing that window to still exist when the other windows have been closed, so MainLoop does not exit.

···

On 1/23/10 5:26 PM, Robin Randall wrote:

Hi all,
I was trying to add a Splashscreen and a Dialog to my app. I got it all
to work and was pleased when I found that Validator could help me pass
data to my Frame and Panel but at the end when I tried to close the app
it just hung. There were no diagnostics or errors in my demo.log file
to help me. Attached is a version which reproduces the problem. Before
adding the Dialog, I think it worked fine. Anybody know why it hangs?

--
Robin Dunn
Software Craftsman