From: Cornelius S. <cor...@we...> - 2004-01-17 12:09:33
|
Hi, i'm using Win2k, Python 2.2.2 and VPython 2002-12-12. I simply want to implement a slider, which controls the value of a variable, but i don't know how to do this. Is there also an easy way to inscribe the slider (title) and show its current value? Another problem I have is the following: I use the gdots function of visual.graph to plot some dots in a gdisplay. How can I clear the display? Thanks for your help. -Cornelius ______________________________________________________________________________ Erdbeben im Iran: Zehntausende Kinder brauchen Hilfe. UNICEF hilft den Kindern - helfen Sie mit! https://www.unicef.de/spe/spe_03.php |
From: Bruce S. <bas...@un...> - 2004-01-17 16:33:42
|
In the current version of VPython there is a module "controls" which lets you create sliders and buttons (albeit a bit primitive). You could pick up the current visual zip file from "Files useful on all platforms" and try it; I think it will run with Python 2.2 (but I might be wrong -- maybe it needs Python 2.3; it uses "properties"). It isn't documented but should be that gdots and other graph objects have attributes that let you get at their parents. For example: g = gdots() g.gdisplay is the gdisplay within which this gdots object was created. g.gdisplay.display is the Visual display within which the graph is displayed, which means that gdots.gdisplay.display.visible = 0 will get rid of the graph window. for obj in g.gdisplay.display.objects: obj.color = color.red # turns everything red Bruce Sherwood Cornelius Sicker wrote: > Hi, > i'm using Win2k, Python 2.2.2 and VPython 2002-12-12. > I simply want to implement a slider, which controls the value of a variable, but i don't know how to do this. > Is there also an easy way to inscribe the slider (title) and show its current value? > Another problem I have is the following: I use the gdots function of visual.graph to plot some dots in a gdisplay. How can I clear the display? > > Thanks for your help. > -Cornelius > ______________________________________________________________________________ > Erdbeben im Iran: Zehntausende Kinder brauchen Hilfe. UNICEF hilft den > Kindern - helfen Sie mit! https://www.unicef.de/spe/spe_03.php > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Gary P. <pa...@in...> - 2004-01-17 16:41:55
|
> Hi, > i'm using Win2k, Python 2.2.2 and VPython 2002-12-12. > I simply want to implement a slider, which controls the value of a variable, but i don't know how to do this. > Is there also an easy way to inscribe the slider (title) and show its current value? > Another problem I have is the following: I use the gdots function of visual.graph to plot some dots in a gdisplay. How can I clear the display? > > Thanks for your help. > -Cornelius I'm trying to do something similar, with mixed success. My approach has been to build a Tkinter application that controls a vpython window. I'm trying to use the Tkinter gui to read and set values in vpython. For example, I'm trying to display a bar representing the value of a variable (energy) by using a Tkinter.Canvas.Rectangle widget. If it works, the idea is to build a Tkinter gui that controls and displays lots of different vpython parameters. So far I've had some success setting parameters in the gui and having vpython respond correctly. Less luck having the gui display values from vpython in realtime. Question for the experts: does this approach have any prayer or working? I'm concerned about having dueling Tkinter applications (mine and the vpython window). I'm wondering with trepidation if I should explore threads ... -gary |
From: Bruce S. <bas...@un...> - 2004-01-17 19:15:47
|
There is a sample program of this kind among the standard VPython demos, Tk-Visual.py. Bruce Sherwood Gary Pajer wrote: > I'm trying to do something similar, with mixed success. > My approach has been to build a Tkinter application that controls a vpython > window. > I'm trying to use the Tkinter gui to read and set values in vpython. For > example, > I'm trying to display a bar representing the value of a variable (energy) by > using a Tkinter.Canvas.Rectangle widget. If it works, the idea is to build > a Tkinter gui that controls and displays lots of different vpython > parameters. > > So far I've had some success setting parameters in the gui and having > vpython respond correctly. > > Less luck having the gui display values from vpython in realtime. > > Question for the experts: does this approach have any prayer or working? > I'm concerned about having dueling Tkinter applications (mine and the > vpython window). I'm wondering with trepidation if I should explore threads > ... > > -gary |
From: Joe H. <hea...@ct...> - 2004-01-17 19:23:10
|
Hi. My classes are using Python23 and VPython under Windows2000. In the new IDLE, pressing F1 only brings up general Python help and not the VPython reference docs. I suspsect this problem is related to the permissions issue that plagues our setup. When I installed the latest VPython last semester, it would only run if the user had administrative privileges. Our "IT" techs cobbled together a solution that works around the usual desktop icon and apparently other things like where students can save programs by default. Any suggestions? Cheers, Joe Heafner -- Astronomy/Physics Instructor |
From: Jonathan B. <jbr...@ea...> - 2004-01-17 19:55:00
|
On Sat, 2004-01-17 at 14:23, Joe Heafner wrote: > Hi. > > My classes are using Python23 and VPython under Windows2000. In the new > IDLE, pressing F1 only brings up general Python help and not the > VPython reference docs. I suspsect this problem is related to the > permissions issue that plagues our setup. When I installed the latest > VPython last semester, it would only run if the user had administrative > privileges. Our "IT" techs cobbled together a solution that works > around the usual desktop icon and apparently other things like where > students can save programs by default. Any suggestions? > > Cheers, > Joe Heafner -- Astronomy/Physics Instructor You can add additional documentation sources manually, by going to the Options menu, selecting Configure Idle..., On the "general" tab, there is a pane on the bottom where you can add additional documentation sources. Just add the path to .../site-packages/visual/docs/index.html Worse comes to worse, you could point it at the docs posted on www.vpython.org. HTH, -Jonathan Brandmeyer |
From: Bruce S. <bas...@un...> - 2004-01-18 16:33:38
|
The standard VPython installer for Windows already configures IDLE in this way (by overwriting one of the configuration files). Open the Help menu (instead of pressing F1) and you should see Visual listed as a choice. Here is the relevant note from the Windows download page at vpython.org: Note to experienced users of IDLE: The VPython installer overwrites Lib\idlelib\config-main.def to add the Visual reference manual to the Help menu, and to make the defaults editor-on-startup= 1 and autosave= 1, as these have proved to be appropriate for most new users of VPython. You may wish to edit the file to reset these parameters to zero, or use the Options menu to reconfigure these options, or save a copy of the file before installing VPython and restore it afterwards. Bruce Sherwood Jonathan Brandmeyer wrote: > On Sat, 2004-01-17 at 14:23, Joe Heafner wrote: > >>Hi. >> >>My classes are using Python23 and VPython under Windows2000. In the new >>IDLE, pressing F1 only brings up general Python help and not the >>VPython reference docs. I suspsect this problem is related to the >>permissions issue that plagues our setup. When I installed the latest >>VPython last semester, it would only run if the user had administrative >>privileges. Our "IT" techs cobbled together a solution that works >>around the usual desktop icon and apparently other things like where >>students can save programs by default. Any suggestions? >> >>Cheers, >>Joe Heafner -- Astronomy/Physics Instructor > > > You can add additional documentation sources manually, by going to the > Options menu, selecting Configure Idle..., On the "general" tab, there > is a pane on the bottom where you can add additional documentation > sources. Just add the path to .../site-packages/visual/docs/index.html > > Worse comes to worse, you could point it at the docs posted on > www.vpython.org. > > HTH, > -Jonathan Brandmeyer > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Cornelius S. <cor...@we...> - 2004-01-17 22:41:51
|
Hi, thanks for your answer. I already tried to create a slider with visual.controls, i neglect to write this. I'm sorry. I also tried to install the current version of VPython, but this requires Python 2.3, and the module "controls" is already implemented in my version of VPython. For better representation I give you my code (so far I've written): slider1 = slider(x=0, y=0, width=2, length=20, action='here I don't know what to do') What should I do, if I want to change the value of for example the variable "k" from 0 to 6 in steps of 0.01 with this slider? Thanks for the answers to my other questions, too. -Cornelius Sicker |
From: Bruce S. <bas...@un...> - 2004-01-18 16:50:56
|
Here's a specific example that does what you want: from visual.controls import * def update(): k = float(int(100*(slider1.value)))/100 title.text = '%s' % k k = 0 title = label(text='0') c = controls() slider1 = slider(x=0, y=0, width=10, length=50, max=6, action=lambda: update()) while 1: c.interact() Perhaps you could suggest how the documentation on these controls could be improved? Thanks. Bruce Sherwood Cornelius Sicker wrote: > Hi, > thanks for your answer. I already tried to create a slider with > visual.controls, i neglect to write this. I'm sorry. > I also tried to install the current version of VPython, but this > requires Python 2.3, and the module "controls" is already implemented in > my version of VPython. For better representation > I give you my code (so far I've written): > > slider1 = slider(x=0, y=0, width=2, length=20, action='here I don't know > what to do') > > What should I do, if I want to change the value of for example the > variable "k" from 0 to 6 > in steps of 0.01 with this slider? > > Thanks for the answers to my other questions, too. > > -Cornelius Sicker > |
From: Andrew D. <dou...@la...> - 2004-01-23 16:18:34
|
On Sat, 17 Jan 2004, Cornelius Sicker wrote: > Hi, > thanks for your answer. I already tried to create a slider with > visual.controls, i neglect to write this. I'm sorry. > I also tried to install the current version of VPython, but this > requires Python 2.3, and the module "controls" is already implemented in > my version of VPython. For better representation > I give you my code (so far I've written): > > slider1 = slider(x=0, y=0, width=2, length=20, action='here I don't know > what to do') I had some degree of success implementing some controls for a simulation of a damped, driven pendulum. It's about 300 lines long, so I won't include it here, but you can download it at http://www.lafayette.edu/~doughera/other/python/examples/drivenpend.py It was my first attempt, and I'm sure there are better ways to do it, but you might find it helpful. -- Andy Dougherty dou...@la... Dept. of Physics Lafayette College, Easton PA 18042 |
From: P H B. <P.H...@bh...> - 2004-01-27 18:13:17
|
Dear all I have downloaded and run Andy Dougherty's program. It is helpful to have an example like this to see how to put several windows on the screen I have increased the number of points displayed in the poincare section to 400 (see attached jpeg: 40 points is not sufficient). On my computer (PC with tft screen) the DISPLAY of the pendulum is very jerky: Can anyone offer help on this? Regards Peter Borcherds > > http://www.lafayette.edu/~doughera/other/python/examples/drivenpend.py > -- Dr P H Borcherds |<mailto:P.H...@bh...> |phone 0044 (0)121 475 3029 |
From: Andrew D. <dou...@la...> - 2004-01-28 14:54:20
|
On Tue, 27 Jan 2004, P H Borcherds wrote: > Dear all > > I have downloaded and run Andy Dougherty's program. It is helpful to have an > example like this to see how to put several windows on the screen Thanks. I don't pretend it's "good" or "right" -- it's just the first thing that worked for me :-). > I have increased the number of points displayed in the poincare section to > 400 (see attached jpeg: 40 points is not sufficient). That, of course, depends both on what you're trying to do and on the speed of your computer (and/or the patience of your users!). In my case, the students were supposed to be exploring period-doubling, so 40 points was plenty. Obviously for more interesting behavior, more would usually be better. > On my computer (PC with tft screen) the DISPLAY of the pendulum is very > jerky: Can anyone offer help on this? Only the observation that I see such behavior (or much worse, a failure to even run) on slower machines or on machines with strained resources. It won't work at all on any of my Linux systems (though none of them are blazingly fast) nor on some of the slower windows systems around here. This is a general problem I've observed with many programs using gdots. I tend not to see it so much using gcurve. I also tend to see such problems when using more than one window, especially on my Linux systems. I vaguely suspect that there is a buried race condition somewhere in the inter-thread communications, and also that there's something amiss with the gdots() representation. However, I haven't been able to track it down further. I may have some oppotunities this spring since I'm using vpython in a course. -- Andy Dougherty dou...@la... |
From: Arnd B. <arn...@we...> - 2004-01-28 15:45:12
|
Hi, On Wed, 28 Jan 2004, Andrew Dougherty wrote: > On Tue, 27 Jan 2004, P H Borcherds wrote: [...] > > I have increased the number of points displayed in the poincare section to > > 400 (see attached jpeg: 40 points is not sufficient). > > That, of course, depends both on what you're trying to do and on the speed > of your computer (and/or the patience of your users!). In my case, the > students were supposed to be exploring period-doubling, so 40 points was > plenty. Obviously for more interesting behavior, more would usually be > better. I am not sure if this is of any help, but we have been using scipy.xplt for things like this. An example is http://www.comp-phys.tu-dresden.de/cp2003/uebung3/standardabbildung.py where we use the standard map (think of this as the Poincare map of something more complicated) - sorry the doc inside is in German. In this example the points are _not_ shown dynamically (i.e. not one after another) but this can be achieved as well. (Notice that, as with most of the newer plotting tools, all the points are kept in memory, but our students had no basic problems running this on their machines (both Linux/Windows) at home). Of course scipy (www.scipy.org) is a pretty big package, but personally I think it is really worth installing ... Arnd |