method for embedding a plot in wx

Le Vendredi 17 Novembre 2006 21:37, vous avez écrit :

1) you seem to have posted this three times -- we really only need it once.

Sorry, I've problem with my email, I didn't receive the mail so I thought it
wasn't send! (sourceforge seems not to like gmail emails)

2) I'd recommend wx MPL, it's a nice way to embed MPL in wx -- it
handles much of this for you.:

http://agni.phys.iit.edu/~kmcivor/wxmpl/

I've already heard a little bit of this package. Only problem is that there
is no installer yet if I didn't miss it, I would have to prepare an ebuild
and also to install on windows too, something I never did. I don't know what
would be the faster for me, maybe going further with matplotlib directly,
maybe I'm wrong.

3) try to enclose a complete app, so we can test and adjust it without
writing a bunch of code ourselves.

...cutted here

Make it simpler, put it in a small app, then post again if you can't get
it to work.

I eventually solved my problem and I can embedded in wx... which was trivial
for examples, maybe because I'm quite new to OO programming etc.

wxglade6.py continously plots curves I hope it may help beginner like me to
embed matplotlib in a wxpython application which generally need the
possibility to update the curve plotted.

I just have one question : why is the wxTIMER passing 2 parameters to method
app.frame1.panel_graf?
I putted an dummy second parameter to solve this problem (without
understanding the reason for that!)

when printing the dummy_parameter it returns :
<wx._misc.TimerEvent; proxy of C++ wxTimerEvent instance at
_a4149bbf_p_wxTimerEvent>

So what?

Long live matplotlib!

wxglade6.py (3.09 KB)

Emmanuel Favre-Nicolin wrote:

2) I'd recommend wx MPL, it's a nice way to embed MPL in wx -- it
handles much of this for you.:

http://agni.phys.iit.edu/~kmcivor/wxmpl/

I've already heard a little bit of this package. Only problem is that there is no installer yet if I didn't miss it, I would have to prepare an ebuild and also to install on windows too, something I never did.

You don't need an installer -- it's a simple python-only module. It includes a setup.py file:

python setup.py install

should do it.

I don't know what would be the faster for me, maybe going further with matplotlib directly, maybe I'm wrong.

wxMPL would have been faster -- and it still might be a good idea - there's some good stuff in there.

I just have one question : why is the wxTIMER passing 2 parameters to method app.frame1.panel_graf? I putted an dummy second parameter to solve this problem (without understanding the reason for that!)

A wxTimer uses the standard wx event system to do it's stuff. Every time an event calls a handler, it passes in the event itself, which often has useful information in it (like the coordinates of a mouse, event, for instance), so event handlers usually have a signature like:

def MyCallback(self, event):

I often use:

def MyCallback(self, event=None):

so that I can call the handler from other code as well.

when printing the dummy_parameter it returns :
<wx._misc.TimerEvent; proxy of C++ wxTimerEvent instance at _a4149bbf_p_wxTimerEvent>

exactly -- you're getting a timer event object.

-Chris

···

--
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@...259...

Emmanuel Favre-Nicolin wrote:

  1. I’d recommend wx MPL, it’s a nice way to embed MPL in wx – it
    handles much of this for you.:


http://agni.phys.iit.edu/~kmcivor/wxmpl/

I’ve already heard a little bit of this package. Only problem is that there
is no installer yet if I didn’t miss it, I would have to prepare an ebuild

and also to install on windows too, something I never did.

You don’t need an installer – it’s a simple python-only module. It
includes a setup.py file:

python setup.py install
should do it.

Yes okay, I´m just more confortable with using package which come with
instalador, especially in this case because I need the program to run
on windows. On linux, I can prepare the package (but it takes some time)

I don’t know what

would be the faster for me, maybe going further with matplotlib directly,
maybe I’m wrong.

wxMPL would have been faster – and it still might be a good idea -
there’s some good stuff in there.

Okay, maybe but right know it’s running perfectly and I have a panel that I can reuse easily in any wxpython application! (and I was willing to understand)

I just have one question : why is the wxTIMER passing 2 parameters to method
app.frame1.panel_graf?
I putted an dummy second parameter to solve this problem (without
understanding the reason for that!)

A wxTimer uses the standard wx event system to do it’s stuff. Every time
an event calls a handler, it passes in the event itself, which often has
useful information in it (like the coordinates of a mouse, event, for

instance), so event handlers usually have a signature like:

def MyCallback(self, event):

I often use:

def MyCallback(self, event=None):

oh yes, exactly that!

···

On 11/20/06, Christopher Barker <Chris.Barker@…259…> wrote:

so that I can call the handler from other code as well.

when printing the dummy_parameter it returns :
<wx._misc.TimerEvent; proxy of C++ wxTimerEvent instance at
_a4149bbf_p_wxTimerEvent>

exactly – you’re getting a timer event object.

-Chris