From: Gary P. <pa...@in...> - 2004-04-29 13:49:39
|
Since there's some discussion going on this subject, let me be explicit about what I'm after. I'd like to create an application with one root window containing various control, canvas, and frame widgets. I'd like one of those widgets to be a visual canvas. Right now I can create a Tkinter window containing all the controls and graphs, but the visual canvas exists in it's own (GTK?) window. It works, but screen management is awkward (two windows). I haven't approached the integration problem yet because I have no experience with GTK at the moment. Furthermore, this is a low-priorty task for me. But I'm watching and will contribute if I can. The application is interactive physics demos/simulations. -gary ----- Original Message ----- From: "Gary Pajer" <pa...@in...> > I'm interested in what you are trying to do. > > Could you please post a minimal complete vpython/gtk script ... maybe one > that just places a sphere at the origin. > > Thanks, > gary > > ----- Original Message ----- > From: "James Philip Roper" <u32...@an...> > To: <vis...@li...> > Sent: Monday, April 26, 2004 10:05 PM > Subject: [Visualpython-users] Re: VPython / python-gtk integration > > > > I have successfully run a simulation in VPython that had a pygtk > > interface using threads. The main thread thread ran the GTK main loop, > > then I had a thread for the simulation. I had issues quitting the > > program (though I often also have the same issues when I'm not using > > threading or pygtk), and there also seemed to be various quirks when I > > tried running it on other platforms. This is the basic idea: > > > > import threading > > > > class simulator(threading.Thread): > > def __init__(self): > > threading.Thread.__init__(self) > > self.runningEvent = threading.Event() > > def run(self): > > while 1: > > self.runningEvent.wait() > > # simulation stuff > > > > def startStopCallback(widget, data): > > if s.runningEvent.isSet(): > > s.runningEvent.clear() > > else: > > s.runningEvent.set() > > > > gtk.threads_init() > > # gtk setup stuff including a start/stop button > > > > s = simulator() > > s.start() > > > > > > The gtk.threads_init() must be called if you are using pygtk and > threading. > > > > One thing that you need to ensure, if you are ever making GTK calls from > > a thread other than the thread GTK is running in, you must use > > gtk.threads_enter() and gtk.threads_leave() before and after you make > > the call. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |