refresh embedded plot

Thank you very much for your advice. Unfortunately when

    > I try to run the script I get:

    > File
    > "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
    > line 310, in RunScript exec codeObject in
    > __main__.__dict__ File
    > "C:\Python24\MathPlot_examples\examples\embedding_in_wx3.py",
    > line 156, in ? app = MyApp(0) File
    > "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\_core.py",
    > line 5301, in __init__ self._BootstrapApp() File
    > "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\_core.py",
    > line 4980, in _BootstrapApp return
    > _core_.PyApp__BootstrapApp(*args, **kwargs) File
    > "C:\Python24\MathPlot_examples\examples\embedding_in_wx3.py",
    > line 111, in OnInit self.panel =
    > XRCCTRL(self.frame,"MainPanel") File
    > "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\xrc.py",
    > line 203, in XRCCTRL return
    > window.FindWindowById(XRCID(str_id)) AttributeError:
    > 'NoneType' object has no attribute 'FindWindowById'

    > Which frankly I don?t understand. Any further advice?
    > Thank you, DG

This looks either like a wx version problem or a bad wx install.

wx gurus, is app = MyApp(0) expected to work on wx-2.5.3 ?

Can anyone test this examples/embedding_in_wx3.py under a similar
configuration?

JDH

John Hunter wrote:

wx gurus, is app = MyApp(0) expected to work on wx-2.5.3 ?

I'm not sure, but

app = wx.GetApp()

should.

Can anyone test this examples/embedding_in_wx3.py under a similar
configuration?

I've been meaning to do this for ages, so I guess now's a good time. I'll report back if/when I get to it!

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

I haven't tried wxPython with Python2.4, but with WinXP,
Python 2.3.2, wxPython 2.5.3.1, and matplotlib 0.72.0,
embedding_in_wx.py
embedding_in_wx2.py
embedding_in_wx3.py

all work ok for me. For completeness,

embedding_in_wx4.py

fails:
   Traceback (most recent call last):
     File "embedding_in_wx4.py", line 22, in ?
       from matplotlib.numerix import rand
   ImportError: cannot import name rand

but replacing
   from matplotlib.numerix import rand
with
   from matplotlib.numerix.random_array import random as rand

fixes that problem. I think embedding_in_wx4.py has some other
problems (Toolbar2 is not visible without a resize, the window
does not respond to all events, including closing the window),
but that's a separate topic.

I agree with John's assessment that the original poster probably
had a bad install of wx. Does the wx demo run ok?? Do any other
matplotlib examples run? If so, another suggestion would be to
try to replace MyApp(0) with PySimpleApp(0).

Hope that helps,

--Matt