From: Stef M. <s.m...@ru...> - 2008-10-31 21:05:15
|
hi Jasper, Jasper Stolte wrote: > Hi all, > > After very little effort I got them working together a few weeks ago > in my pendulum simulator, which can be downloaded from google code.. I > wanted to post the result to the wx-python list when it is a bit more > mature, as it's not quite finished yet. Anyway, run src/main.py, > screenshot attached. It's got a wxPython part which shows a slider > with which you can influence the pendulum length. Under Linux, this is > a real-time simulation, but under Windows I guess smth is messed up > with the wx.Timer so it is very slow. I tested under winXP-SP2 and it's not slow, but it's not fluently. The wx.Timer has a 15 msec resolution, your demo wants 20 msec, so when you print the elapsed time, you get 15 or 30 mseconds, with probably an average of 20 msec ? Also interesting to know that the processor loads varies a lot, between less than 1% upto 15% (dual core). On the same machine I have Ubuntu in Virtualbox installed. It's funny to see that in Windows/Virtual box/Ubuntu it runs fluently, time varies between 18 .. 22 msec. So I'm very satisfied about the Virtualbox. So the machine is not the problem, but indeed the implementation of wx.Timer under windows. I'll post a question on the wxPython list if it's possible to replace the timer by a high-resolution timer ( I won't mention your application yet ;-), I also need it for 2D simulation. I'm not familiar with VPython, but I guess you can set the antialiazing of the graphics card in there. I did set it manual on my graphics card and it looks much more beautiful. Now an interesting extension of your program would be to introduce a disturbance, simply by pressing a button, but even nicer by shaking the VPython window ;-) We just ran it on another computer windows/linux: Fedora 9.0, 200 fps ==> 50% processor time (dual core) , winXP-SP2, 200 fps ==> processor use 20% (time between frames 0,0,0,15, , so indeed an average of 5 msec) So indeed it's very well possible to make nice applications with wxPython + VPython. thanks very much, cheers, Stef > > >> svn checkout */http > <http://pendulum-cart.googlecode.com/svn/trunk/>/*://pendulum-cart.googlecode.com/svn/trunk/ > > Anyway, the solution really was as simple as mentioned here. You can > just import visual and create a scene. This scene will then be > displayed in a separate window. As long as you keep track of the > visual object in the wxPython framework, you can manipulate it any way > you like from the wxPython program. > > Even nicer would be if somehow the OpenGL canvas would be available in > Python visual object, so you could really draw it to a wxPython > window. Now there's that extra GTK frame hanging around with the 3D > rendering. Not that this is a big issue or anything. Just something to > put on the wishlist for when the important things are already working.. ;) > > Greetz, > Jasper > > > > On Fri, Oct 31, 2008 at 1:36 AM, Stef Mientki <s.m...@ru... > <mailto:s.m...@ru...>> wrote: > > Jose, Bruce, > > thanks for your answers.... > > Jose Antonio Martin H wrote: > > Hi , > > > >> This doesn't seem to be possible at first sight, because both > >> environments claim the main loop > >> > > > > Vpython does not claim a main loop. > > > > You can simply create the scene, the objects, etc... > > > > And have your Wxpython program running, vpython will continue > executing and > > you can change the objects of vpython from whithin your App > directly. > > > That sounds really simple. > I've to admit, that I never investigated the possibilities, > because on the wxPython list, this is the usual answer: > > "Both wxpython and vpython are great tools, which I'd love to use > together for my program. The problem is they each run their own event > loop. Now almighty Google taught me there were some ancient threads on > the topic stating it would be very hard to combine the two." > > If I've some more time I'll certainly will try it. > > btw, does anyone has a (working) example of wxPython + VPython ? > > thanks again, > Stef Mientki > > > Also, you can indeed control the speed at wich the vpython do > what it to > > with the rate() comand, or just ignore it for full speed. > > > > Thats all. > > > > Hope this help. > > JAMH. > > ----- Original Message ----- > > From: "Bruce Peterson" <bap...@te... > <mailto:bap...@te...>> > > To: <vis...@li... > <mailto:vis...@li...>> > > Sent: Friday, October 31, 2008 12:30 AM > > Subject: [Visualpython-users] Vpython and wxPython > > > > > > > >> Hi Stef > >> I did this some years ago, but as I recall, the key to using > >> Vpython from Wx python is to create a client-server architecture. > >> Create your Vpython application as a com object with variable > >> parameters expressed as public methods. The server is launched from > >> your Wxpython application. The Wxpython app provides the UI and > >> allows updating the Vpython parameters with each pass through > the control > >> loop. > >> > >> Bruce > >> > >> At 03:10 PM 10/30/2008, you wrote: > >> > >>> From: Stef Mientki <s.m...@ru... <mailto:s.m...@ru...>> > >>> Precedence: list > >>> MIME-Version: 1.0 > >>> To: vis...@li... > <mailto:vis...@li...> > >>> Date: Thu, 30 Oct 2008 00:18:31 +0100 > >>> Message-ID: <490...@ru... > <mailto:490...@ru...>> > >>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >>> Subject: [Visualpython-users] WPython + wxPython possible ? > >>> Message: 5 > >>> > >>> hello, > >>> > >>> now there's some activity on the list, > >>> I (and many other wxPython users) would love to use VPython from a > >>> wxPython application. > >>> > >>> This doesn't seem to be possible at first sight, because both > >>> environments claim the main loop > >>> (but I'm not an expert). > >>> > >>> There's an example on youtube: > >>> http://www.youtube.com/watch?v=nMNzMwDXHLA > >>> > >>> but this could well be 2 separate applications, > >>> communicating in some clever way. > >>> But that's also an acceptable solution. > >>> > >>> Any suggestions / answers / links ? > >>> > >>> thanks, > >>> Stef Mientki > >>> > >> > ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your Move Developer's > >> challenge > >> Build the coolest Linux based applications with Moblin SDK & > win great > >> prizes > >> Grand prize is a trip for two to an Open Source event anywhere > in the > >> world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > >> _______________________________________________ > >> Visualpython-users mailing list > >> Vis...@li... > <mailto:Vis...@li...> > >> https://lists.sourceforge.net/lists/listinfo/visualpython-users > >> > >> > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > > Build the coolest Linux based applications with Moblin SDK & win > great prizes > > Grand prize is a trip for two to an Open Source event anywhere > in the world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > > _______________________________________________ > > Visualpython-users mailing list > > Vis...@li... > <mailto:Vis...@li...> > > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > <mailto:Vis...@li...> > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ------------------------------------------------------------------------ > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |