VPython display issues.

511 views
Skip to first unread message

Sean Con

unread,
Jul 7, 2014, 10:55:16 AM7/7/14
to vpytho...@googlegroups.com
Hello

I am using VPython in 64 bit netrunner Linux.

However, consider this code:

from visual import *
ball = sphere(pos=(-5,0,0), radius=0.5, color=color.cyan)

I am
using python2. VPython is not compatible with Python 3.4

However, this, when ran in python console, produces an empty gray window, with nothing rendered.

If i give the command quit() to console, the window renders things, and is responsive to the mouse events, e.g. rotate and pan.

Where am I going wrong?

Also, I don't find any info on CSG (Constructive Solid Geometry) for VPython - i must have escaped my notice. Please help.



Steve Spicklemire

unread,
Jul 7, 2014, 11:28:17 AM7/7/14
to vpytho...@googlegroups.com
You need to call rate() periodically.

--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruce Sherwood

unread,
Jul 7, 2014, 11:34:18 AM7/7/14
to vpytho...@googlegroups.com
There is no CSG in VPython, though Kadir Haldenbilen, who was the driving force behind the extrusion and 3D text objects, recently told me about a CSG possibility, which I've not had time to study. My impression is that in the past there was no real-time CSG due to the large amount of computation involved.

Did you build VPython 6 from source? If by "running in python console" you mean that you entered the statements in the shell window, you indeed won't see anything because there is no opportunity for VPython rendering to occur. Here are two ways to work:

1) Use the VIDLE text editor that comes with VPython and press F5 to run full programs rather than entering statements one at a time in the shell window. Your two-line program will execute correctly even without a rate statement because VPython uses the atexit module to effectively append "while True: rate(1)" to the end of your program. You can't use the standard IDLE text editor because it has a bug that doesn't honor the atexit machinery.

2) Use any text editor to create your program, save it, then run the program from a terminal (python test.py).
Reply all
Reply to author
Forward
0 new messages