Delaying Dialog Display

When my application loads, the main frame is displayed with the splash
screen in front of it. The splash screen has a display time of 3 seconds; if
the user clicks on it, the screen is hidden and a wx.FutureCall() waits 2
seconds then calls MainFrame.Show(). This all works just fine.

   However, I want to display the login dialog box _after_ the splash screen
and now it's displaying in front of the splash screen. This sequence is in:

class PwApp(wx.App):
     def OnInit(self):
         self.SetAppName("PermitWatch")

         # Create and show the splash screen.
         splash = PwSplashScreen()
         splash.Show()

         dlg = LoginDialog()
         dlg.Show()

         frame = MainFrame(None, -1, "")
         frame.Show()

         return True

   I've tried to put a wx.FutureCall() between splash.Show() and dlg =
LoginDialog() but could not find the correct syntax.

   When I put 'time.sleep(5)' between splash.Show() and dlg = LoginDialog()
the application waits 5 seconds before displaying, then the splash screen
flashes on and off and the login dialog box is shown in front of the main
frame.

   Is this class the correct place to insert a delay, or should that be done
in the splash screen class (which uses the 3.0 demo code)?

Rich

after the first Show (on the splash) try wx.Yield() then a time.sleep(5)… the Yield call should allow the GUI to think and refresh itself (according to any of the GUI stuff Show has associated with it) then after the screen updates, you should sleep, then go into the login stuff.

Note, the sleep call will likely block the GUI…

Why not instantiate the LoginDialog, then pass it to the SplashScreen, and have the splash screen decide when to Show it?

···

On Friday, July 18, 2014 10:13:09 AM UTC-7, fuzzydoc wrote:

When my application loads, the main frame is displayed with the splash

screen in front of it. The splash screen has a display time of 3 seconds; if

the user clicks on it, the screen is hidden and a wx.FutureCall() waits 2

seconds then calls MainFrame.Show(). This all works just fine.

However, I want to display the login dialog box after the splash screen

and now it’s displaying in front of the splash screen. This sequence is in:

class PwApp(wx.App):

 def OnInit(self):

     self.SetAppName("PermitWatch")



     # Create and show the splash screen.

     splash = PwSplashScreen()

     splash.Show()



     dlg = LoginDialog()

     dlg.Show()



     frame = MainFrame(None, -1, "")

     frame.Show()



     return True

I’ve tried to put a wx.FutureCall() between splash.Show() and dlg =

LoginDialog() but could not find the correct syntax.

When I put ‘time.sleep(5)’ between splash.Show() and dlg = LoginDialog()

the application waits 5 seconds before displaying, then the splash screen

flashes on and off and the login dialog box is shown in front of the main

frame.

Is this class the correct place to insert a delay, or should that be done

in the splash screen class (which uses the 3.0 demo code)?

Rich

after the first Show (on the splash) try wx.Yield() then a
time.sleep(5)... the Yield call should allow the GUI to think and refresh
itself (according to any of the GUI stuff Show has associated with it)
then after the screen updates, you should sleep, then go into the login
stuff.

Note, the sleep call will likely block the GUI...

Nathan,

   Yes, it does.

Why not instantiate the LoginDialog, then pass it to the SplashScreen, and
have the splash screen decide when to Show it?

   I think that I tried this before, but ... perhaps not. Certainly worth
trying again. Will report results.

Thanks,

Rich

···

On Fri, 18 Jul 2014, Nathan McCorkle wrote:

Nathan,

   Had not tried instantiating the login dialog from within the splash screen
class. It works well after adjusting the wx.FutureCall() delay to 4 seconds
for the 3 second splash screen delay. I think that was the critical factor.

Many thanks,

Rich

···

On Fri, 18 Jul 2014, Rich Shepard wrote:

I think that I tried this before, but ... perhaps not. Certainly worth
trying again. Will report results.