|
From: Ray A. <ray...@sa...> - 2006-04-24 13:27:45
|
Thanks - wx.BeginBusyCursor is just what I've been looking for with the
mouse, and I've just read a previous answer from you on using
wx.ProgressDialog (msg_id=8819839) which was very helpful too. My code now
looks like this:
wx.BeginBusyCursor()
wait=wx.ProgressDialog('Please wait..','Fetching attachment data',0)
...
wait.Destroy()
wx.EndBusyCursor()
Ray
----- Original Message -----
From: "Alex Tweedly" <al...@tw...>
To: "Ray Allen" <ray...@sa...>
Cc: <pyt...@li...>
Sent: Monday, April 24, 2006 12:25 PM
Subject: Re: [Pythoncard-users] Creating a timed dialog and mouse egg timer
Ray Allen wrote:
>I'd like to do two things in pythoncard related to informing the user that
>a
>new modal child window is about to open (it involves fetching data and
>therefore can take a while): 1. Create a dialog that closes automatically
>when the child window opens (eg. Please wait..data loading) and 2. give
>the
>mouse arrow an egg timer. Are these simple things to make happen in
>Pythoncard? I'm hoping to stop the user repeatedly hitting a load button
>when the event has been called. Thanks,
>
>
Yes, easy to do.
I don't think you want a dialog - a dialog *always* requires user input,
and after opening a dialog, control doesn't return to your code until
that user input has happened.
Two suggestions:
1. a simple child window containing the message. Create it as a child
window, separate resource file with just a static message. Mark it "not
visible on startup" in the layoutEditor's "Edit Background info".
In your initialization code,
self.messageWindow = model.childWindow(self, message.MyBackground)
Then, when you start the process, you'd do something like
self.messageWindow.visible = True
wx.BeginBusyCursor()
and when the data is all loaded and you are ready to launch the real
child window, do
self.messageWindow.visible = False
wx.EndBusyCursor()
(btw - the Begins and Ends must match - if there's any danger they
won't I've used the brute force method
while wx.IsBusy():
wx.EndBusyCursor()
)
Suggestion 2:
Use the child window you are loading the data for. On initial startup of
the data window, set all the "normal" components of that window to
invisible, and the "loading ... please wait" text to visible (and do the
wx.BeginBusyCursor()). Then once all the data is loaded, you can reverse
the visibility of those components.
I'd probably do the first of those - but the second does have the
advantage of being one fewer childwindow to deal with, and may be a
nicer UI with fewer windows "flashing" up and down again.
Either way, watch out for the fact that the cursor being busy is "per
window", so you may need to, or want to, also set the BeginBusyCursor()
within your message window / child window.
Also, if you can determine anything about the progress of the data
loading, it might be good to provide a progress bar.
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.5/322 - Release Date: 22/04/2006
|