[Pythonmac-SIG] Where to go for wxPython help & tutorials?
Chris Barker
Chris.Barker at noaa.gov
Thu Jun 16 22:23:46 CEST 2005
Louis Pecora wrote:
> Chris Barker wrote:
>> If you are interested in using FloatCanvas, you should send me a note,
>> and I'll send you the latest version, and I can add you to a
>> low-traffic mailing list for announcements and technical discussion.
>
> Thanks for the offer. I'll take you up on it.
I've added you to the list, and I'll send you the latest in a separate
email.
>> I'm curious why you don't think matplotlib will help you here, though
>> perhaps you mean it can't do the job by itself, which makes sense,
>> it's a plotting library, not a GUI toolkit. Matplotlib + wxPython is a
>> potent combination, however.
>
> Because matplotlib presents the plot at the end of the program.
No it doesn't. At least it doesn't have to. That is the one fault I have
with matplotlib, the docs are so focused on how you can use it like
Matlab, that new users don't realize what a rich interface it provides
for real OO programming.
> My
> programs are written to be interactive and continue running, i.e.
> calculate something or massage data, plot the result, close the plot
> window, do more stuff, check another plot, or other options not in any
> particular order.
matplotlib is fully capable of doing all that. Look in the docs and
mailing list for "embedded in wx" and "OO interface" and things like
that. The core issue is that you want your program to manage the
plotting window, not pylab. That's what embedded in wx means.
>> What kind of data are you trying to display, and how do you want it to
>> look? I(we) can help steer you in the right direction.
>
> I just need simple plotting. Example, feed a function a table of
> values over a common x-axis, plot them all in a window maybe each a
> different color and/or line thickness. Nothting fancy.
There is also wx.lib.plot, which can do this. However, we all know how
these things work out: you start with simple needs, then suddenly you
need a log plot or something. I'd take the time to figure out
matplotlib. Much as I'd like to have you as a FloatCanvas user/bug
reporter/ contributer, I think matplotlib is probably what you need.
> But gotta keep
> that program going when the window is closed. Possible problem: I use
> standard I/O to "talk" to the program (e.g. print and readline) in a
> terminal window. I don't have time for a fancier GUI and I really don't
> need one.
This is a bit of a problem. In general, with wxPython, when you start
the mainloop, the python interpreter halts and waits for it to finish
before continuing, so it's hard to mingle wxPython and the command line.
A few options to address this:
1) ipython
2) PyCrust
3) GUI_thread (or something, with scipy. I think that may be a sleeping
project, however)
Also, in the pile of demos I sent is one called "ProceduralTest.py"
which shows how you can pop up a bunch of wxPython dialogs in a
procedural program (as opposed to an event-driven one). Perhaps you
could pop up matplotlib windows the same way.
I've enclosed that demo, with a raw_input() call, to test it. It seems
to work OK, except that focus doesn't return to the terminal window
properly.
> Incomplete means I can't find a list of classes, colors, event
> defintions, etc. It's just random hunting.
Well, it's not all that well indexed, but it's there. Have you found the
"Alphabetical Class Index"
> Chris, Thanks for your help and encouragement. Back to the drawing
> board.
You're welcome. I've found myself to be very productive in wxPython, so
I like to spread the word.
-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 at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProceduralTest.py
Type: text/x-python
Size: 2222 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20050616/5a88791d/ProceduralTest.py
More information about the Pythonmac-SIG
mailing list