Thanks everyone for the advice.

For anyone in my boat following this thread, here's what I ended up  
doing:

Had a stroke of insight and coded the whole thing up (poorly) using  
maptlotlib w/no polling. In other words, the entire API sat in the  
mouse click callback function. Lame, yes---especially since some  
expensive AI search can be going on that takes more than a few  
seconds---but as long as my students take care not to enter more than  
one mouse click before each screen update, the app doesn't seem to  
suffer from inconsistency problems. Its pretty darn nice looking w/ 
matplotlib, too. So, that's the band aid.

I'm sad to hear that its not as easy to use matplotlib to write more  
sophisticated apps than it is w/matlab but am glad that it is  
documented here. To summarize what I gleaned from Chris, the  
maptlotlib (interactive?) thread doesn't handle anything but its own  
stuff (e.g. mouse callbacks) directly, so my attempt to use the  
threading event/wait stuff failed for that reason (?). The pyrobotics  
app would be a good candidate for using matplotlib, but might not be  
easy to use for similar reasons. I am wondering if a socket-based  
approach, where matplotlib served up, for instance, mouse clicks,  
plots, etc, to a client app might be a good compromise.

I am still unclear how John's recs for timer or idler (which I've  
been able to find no accessible documentation on) would have helped  
me. For instance, wouldn't the timer rec fail for the same reason my  
event wait thread hack did? Being sad, however, I understand that the  
main focus of matplotlib is high- and scientific-quality graphics,  
for which it seems to hit the nail on the head.

Francisco's rec to the "for non-programmers programming a GUI"  
document looks very worthwhile (and I am a seasoned programmer). I  
intend to have a serious look at it this summer, b/c I intend to  
write a more serious app using Python that needs a GUI (an audio file  
viewer and editor to be used for my music perception research). The  
document does indeed seem like a good introduction to event-based  
programming, and had I a week or more to spare, would probably have  
tried using the related packages to build the app.

Before the stroke-of-insight, I got lucky and managed to get a simple  
Tk app working that handled displaying the game and processing mouse  
clicks, but I foiled in my attempts to capture keyboard input, so  
after several hours gave up. It does seem wx is more suited for OS X,  
and my brief googling seems to imply that Tk is becoming the thing  
people---esp on OS X---USED to use. I've heard that Apple's own  
InterfaceBuilder is THE WAY to program GUI-based apps and wonder if  
anyone has had experience using this w/Python?

Thanks again for the advice. A last question for Chris...

> If it does look promising, be sure to get the latest version from:
>
> http://www.mithis.com/~chrisb

I never found the time to finish my matplotlib-scipy install from  
source (b/c of the apple's wx incompatibility), but I do intend to  
finish with that business when I return in June and am wondering if  
your above rec about a wx latest-version would interfere with that?

--b



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to