From: Leighton P. <lp...@sc...> - 2005-03-24 14:37:07
|
Hi,=0D=0A=0D=0AMany thanks (again) to Matt for his suggestions - I had a "D= 'oh" moment=0D=0Awhen it was pointed out where I was calling the update fro= m.=0D=0A=0D=0AMatt's solution works on OS X, but I'm afraid I didn't specif= y what my=0D=0Agoal was particularly well. I'm aiming to dynamically updat= e a=0D=0Amatplotlib plot embedded within a wx.Panel (or wx.Frame) from anot= her=0D=0Aobject, whose internal state is changing so that the calling objec= t's=0D=0Ainternal state is reflected in the matplotlib plot. The wx.Timer=0D= =0Asolution doesn't seem appropriate for that (though if I'm wrong, I'm=0D=0A= happy to take advice).=0D=0A=0D=0AAfter some reading around, I worked up tw= o alternatives for updating the=0D=0Aplot from another object.=0D=0A=0D=0A1= ) wx.Timer, as per Matt=0D=0A2) Loop, and pass the value of the loop counte= r=0D=0A3) A custom wx event, bound to the update method=0D=0A=0D=0AThe code= at http://widdowquinn.pwp.blueyonder.co.uk/wxtest.py implements=0D=0Aall t= hree methods, and how effective they are appears to be OS-=0D=0Adependent:=0D= =0A=0D=0AThe wx.Timer method works on Windows (XP SP2), Linux (FC3) and OS = X=0D=0A(10.3)=0D=0A=0D=0AThe Loop method and custom event methods work fine= on Windows. On=0D=0ALinux, they dynamically update the plot, but not the = button label. On=0D=0AOS X, they do nothing, and only appear to update the= plot after the=0D=0Aloops end.=0D=0A=0D=0ADoes anyone here have any ideas = on how I could progress further on=0D=0Agetting this to run, and update cor= rectly under OS X=3F Or should I go=0D=0Aand bug the wxPython-Users list a= bout it=3F ;)=0D=0A=0D=0AFor info, all three systems are using Python 2.3.5= =2E, matplotlib 0.73.1,=0D=0Aand wxPython 2.5.3.1.=0D=0A=0D=0ACheers,=0D=0A=0D= =0A--=20=0D=0ADr Leighton Pritchard AMRSC=0D=0AD131, Plant-Pathogen Interac= tions, Scottish Crop Research Institute=0D=0AInvergowrie, Dundee, Scotland,= DD2 5DA, UK=0D=0AT: +44 (0)1382 562731 x2405 F: +44 (0)1382 568578=0D=0AE:= lp...@sc... W: http://bioinf.scri.sari.ac.uk/lp=0D=0AGPG/PGP:= FEFC205C E58BA41B http://www.keyserver.net =20=0D=0A(If the si= gnature does not verify, please remove the SCRI disclaimer)=0D=0A_ _ _ _ _ = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _=0D=0A=0D=0A= DISCLAIMER:=0D=0A=0D=0AThis email is from the Scottish Crop Research Instit= ute, but the views=20=0D=0Aexpressed by the sender are not necessarily the = views of SCRI and its=20=0D=0Asubsidiaries. This email and any files trans= mitted with it are confidential=20=0D=0Ato the intended recipient at the e-= mail address to which it has been=20=0D=0Aaddressed. It may not be disclos= ed or used by any other than that addressee.=0D=0AIf you are not the intend= ed recipient you are requested to preserve this=20=0D=0Aconfidentiality and= you must not use, disclose, copy, print or rely on this=20=0D=0Ae-mail in = any way. Please notify pos...@sc... quoting the=20=0D=0Aname = of the sender and delete the email from your system.=0D=0A=0D=0AAlthough SC= RI has taken reasonable precautions to ensure no viruses are=20=0D=0Apresen= t in this email, neither the Institute nor the sender accepts any=20=0D=0Ar= esponsibility for any viruses, and it is your responsibility to scan the em= ail=20=0D=0Aand the attachments (if any).=0D=0A |