On Nov 26, 2010, at 8:31 AM, Iain Simpson wrote:
> I have a map image displayed.
> If the user clicks a button the image will be zoomed by accessing more
> detailed 'tiles' - if these are not held locally I need to go to the
> internet to obtain and save them (create_big). This may take some time.
> To cater for this I want to display a low resolution image (lfile) which
> is stored locally.
>
> How can I ensure that the image is updated immediately so the user sees
> and a change ?
I've noticed that wxPython tries to be 'smart' about some things, and
doesn't always repaint when you want it to. The general solution is to break up
the processing by inserting a small interval of time; the
dabo.ui.callAfterInterval() method works well in this case. Modifying your
code, it would look something like:
-------------------------------------------------------
def onHit(self, evt):
(lDef,lFile)=zoom_in(1,self.Form.dImap.Map_def)
lZ=lDef[0]; lX=lDef[1]; lY=lDef[2]
self.Form.dImap.Map_def=(lZ,lX,lY)
# redisplay with new image
self.Form.dImap.Picture=lFile # Temporary image
self.refresh()
dabo.ui.callAfterInterval(50, self._makeBig, lZ, lX, lY)
def makeBig(self, lZ, lX, lY):
if create_big((lZ,lX,lY)):
# hi-res image
self.Form.dImap.Picture='bigone.png'
# if hi-res not available - keep low res visible
-----------------------------------------------------
You may need to adjust the interval from 50 msec to a longer one, but
50 is generally a good start. Let me know how this works for you.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]