Questions tagged [vpython]

A free, open-source module for producing real-time 3D scenes with Python.

VPython makes it unusually easy to write programs that generate navigable real-time 3D animations. It is based on the Python programming language.

See http://vpython.org/

345 questions
0
votes
1 answer

Vpython greyscreen crash

I have found many times a solution for my problems from here, but this time I am totally baffled. I don't know what's wrong at my code. I made a code to create a box with charged particles inside with Vpython. As I launch the program, I get only a…
0
votes
1 answer

Rotate multiple objects at different rates in VPython at the same time

I am practicing my coding for physics and I am a little stuck on the following problem: "Using the facilities provided by the visual package, create an animation of the solar system that shows...Sun and planets as spheres in their appropriate…
Nora Bailey
  • 15
  • 1
  • 5
0
votes
1 answer

How to install VPython on Python 3.6 (python distribution)?

I want to get Vpython on Python 3.6(Python Distribution). I couldn't find an option except for anaconda. Please help because I want to process the data coming from Arduino to Python making 3D visualizations.
0
votes
1 answer

Simulating Orbits

So I'm trying to simulate the earth travelling around the sun where the velocity of the earth is determined by the angle its at to the origin and the horizontal. I did this by creating a function that uses tanh (opposite/adjacent) rule for…
ojj920
  • 27
  • 4
0
votes
1 answer

Basic Vpython code error - "TypeError: bad operand type for unary -: 'tuple'"

First off my apologies if this is a noob issue but I am completely new to coding. I am following a guide on building a harmonic oscilation simulator in Vpython but every time I try to run the program I get this error. File…
0
votes
1 answer

Constructing a simple atomic lattice with VPython (Python 3.6.1)

I am currently working my way through Mark Newman's Computational Physics and I've encountered some trouble doing the exercises on 3D modelling using the VPython module. I'm attempting to construct a simple L*L lattice and display it using the…
0
votes
1 answer

Vpython not working after update

I'm using ubuntu 16.04 and python files that were using vpython that were working fine before now crash showing from visual import * ImportError: No module named visual. I installed anaconda, still nothing. I launched jupyter notebook on the…
0
votes
4 answers

extract number from exponent in Python

Hi everyone / Python Gurus I would like to know how to accomplish the following task, which so far I've been unable to do so. Here's what I have: Q1 = 20e-6 Now this is an exponential number that if you print(Q1) as is it will show: 2e-5 which is…
jebc88
  • 21
  • 4
0
votes
1 answer

Loop to change spring lengths doesn't change anything when I run it

The project I'm working on is supposed to model a pulse moving down a set of spheres connected by springs. I am trying to decrease the spring length as the pulse moves down the chain, but when I run it, nothing happens. Here's my code: from…
A. Kern
  • 1
  • 1
0
votes
2 answers

making objects constantly in a while loop

I'm doing a project for a year 11 physics class and I'm trying to make a battery that generates electrons. This is the code: electron = sphere(radius = 1, color = color.yellow, vel = vec(-1,0,0)); while battery.voltage > 0: eb =…
0
votes
1 answer

Python with Visual and VPython for graphics

Let me try and explain my problem better. I'm having problems with the VPython module and visual. If I run a python 2.7 script and use the "import visual" statement to let me make a plot, I get the following error message: "This program needs…
Natsfan
  • 4,093
  • 3
  • 22
  • 29
0
votes
1 answer

Compare items of a list sequentially with another one then use one by one in VPython application

I have grid of objects in Vpython created by this code: iX = [(x - pointW // 2) * sclFact for x in range(pointW)] iY = [(x - pointH // 2) * sclFact for x in range(pointH)] iYr = iY[::-1] xy = list(itertools.product(iX,iYr,)) ixyz =…
0
votes
1 answer

How to differentiate between adjacent boxes of same size and color in vpython

I have a code to place boxes of similar size and color, adjacent to each other in Vpython. However on rendering them, they look seamless(like one bigger box). Is there any way to add borders or any other way i can disgustingly render these boxes?…
0
votes
0 answers

vpython visualizing electric pot

I am trying to visualize the electric potential for a prism using vpython. My code is working and am getting the correct 20x20 array for the data but can not figure out a way to represent this using 3D objects in vpython. For this problem, I would…
0
votes
1 answer

Vpython userspin does not work

I have a function call on button click which is used to display a number of cuboids. However i want the ability to rotate my frame on user mouse drag so as to get the desired viewing angle (as preferred by user) However, i cant seem to rotate as…