Hi,
I"m brand new to wxPython. My interest derives from my work developing VPython (vpython.org), which allows even novice programmers to write short Python programs that generate real-time navigable 3D animations, exploiting OpenGL without having to know anything about OpenGL. For example, the following minimal but complete program creates a white 3D cube, with a camera that is zoomable and rotatable with the mouse:
Welcome to the wacky and wonderful world of wxPython!
from visual import *
box()
Currently the Mac version of VPython is based on Carbon, and I need to move to Cocoa to stay viable and to be able to use 64-bit Python on a Mac. More generally I’m attracted to using the wxPython canvas with OpenGL on all platforms, Windows, Mac, and Linux. Currently there is platform-specific code for the three platforms to create windows and get events. Moreover, there are unpleasantly complex connections between the user’s Python code and lots of C++ code, using the Boost libraries.
For the benefit of novices, I would like the user’s program to be able to look something like the following (which is how an existing VPython program can look):
from visual import * # get the VPython objects (box, cylinder, etc.) and initiate wxPython
b = box()
while True:
rate(100) # clamp to no more than 100 iterations/second; render 3D scene; trigger event callbacks
b.pos.x += .001 # animate the box, moving to the right across the screen
I realize that wxPython’s MainLoop() doesn’t return but continually dispatches events to callbacks, but is there a way that the rate function shown above could drive the internals of MainLoop, and thereby trigger event callbacks?
Another way of expressing what I want to be able to do is to run the user’s program as an idler function, but I don’t want novice programmers having to set up callbacks themselves. I hope I’ve made it clear what I want to do, but if not, please ask for clarification.
I’ll mention that I’m also developing a JavaScript/WebGL environment, similar to VPython. It’s called GlowScript (glowsccript.org). It too makes it feasible for novice programmers to write programs that generate real-time navigable 3D animations, exploiting WebGL without having to know anything about WebGL.
I don’t know if this will help or not, but I found this old thread on replacing the main loop: http://wxpython-users.1045709.n5.nabble.com/wxPython-Replacing-Main-Loop-td2275701.html
I seem to recall another thread on something similar to this, but Google isn’t turning it up for me. Maybe one of the other venerable wxPythoneers will know.
- Mike
···
On Wednesday, June 20, 2012 9:59:41 PM UTC-5, Bruce Sherwood wrote: