I started using wxPython very recently, and I've been very impressed by
how easy it is to put together a working application in wxPython.Unfortunately, I've run into my first sticking point, and I'm hoping someone
on the list can help me out.My application does the following in sequence:
(1) displays a wx.grid in a wx.flatnotebook page,
(2) performs some computationally intensive operations, and
(3) displays another grid in a new notebook page.Is there a way to force the first grid to display before step (2) starts
running?
yes -- but how your code is structured makes all the difference.
Would putting step (2) in a separate thread help?
That would help if you want the GUI to be responsive while the
computation is going on -- if you jsut want them to have somethign to
look at, that shouldn't be required.
Regardless of whether the application is multithreaded, I would think that I
could at least force the first grid to display before step (2) starts
chugging away. I've put a lot of research into this, and no matter what I
try, both grids display at once in their separate notebook pages, after a
long delay caused by step (2). For example I've tried to call the first
grid's ForceRefresh() method before step (2), but that doesn't help.I'm not sure if this matters, but the steps above are all within the same
event handler.
That may the problem, yes. event handlers are blocking -- no other
event,s no other code will run until the handler is completed.
You *may* be able to call:
the_grid.Refresh()
the_grid.Update()
before the computation (Update() means draw this now) (assuming you've
already called Grid.Show()
But it would probably be more robust if you didn't put then all in teh
same handler. An easy way to do it would be to have you handler do:
#create the first grid.
wx.CallAfter(the_function_to_do_the_computation)
At the end of the_function_to_do_the_computation, put in a call to
create the second grid (I presume it needs data form the computation
to do its thing...
if that doesn't do it-- we'll need to see code:
http://wiki.wxpython.org/MakingSampleApps
-Chris
···
On Tue, Jun 5, 2012 at 10:57 AM, Nicholas Montpetit <n.d.montpetit@gmail.com> wrote:
Let me know if any other details about the program would be relevant.
Thanks so much for your help!
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov