2

I have installed vpython (check http://vpython.org/ ) in python 3.6 (and Windows 10) from cmd by typing pip install vpython, and it installed successfully.

But when I type from vpython import * in IDLE, even after a couple of reinstalling, it's redirecting me to localhost:50484, and I can't do any Vpython stuff in IDLE.

What should I do to fix the issue, and run VPython on my PC properly ?

After googling up, I think my problem of vpython is pretty unique.

katana_0
  • 183
  • 1
  • 8
  • So what exactly is the issue? What you want to do? The question is not clear. Please add more details to the question for understanding, else the question will be closed. – Jaffer Wilson Sep 01 '17 at 06:46
  • @JafferWilson Done – katana_0 Sep 01 '17 at 06:47
  • Actually, you have mentioned `What should I do to fix the issue ?` so what is the issue? whether you don't want to redirect to localhost or anything else. Where do think you want to redirect the program. – Jaffer Wilson Sep 01 '17 at 06:49
  • 1
    @JafferWilson I mean I can't do anything. For example, when you type `from turtle import *`, nothing happens, and you can do turtle stuff easily in IDLE. But when you type `from vpython import *`, not only you can't do any simulation after that, but it also redirects you to `localhost:50484`. (eg when you type `box()` after importing, it should display a box, but now it's just showing `` ) – katana_0 Sep 01 '17 at 06:51
  • So you do not want any redirection to localhost but only the standalone python application that runs on the python command window. Am I right? – Jaffer Wilson Sep 01 '17 at 06:54
  • @JafferWilson (Sorry, I am a beginner I don't quite get what you're saying). I just want to know how to display stuff using vpython on my PC, but when I do the analogous things what I do for turtle, it does nothing. (Also, what's the point of redirection to localhost ? It's not doing anything - sitting like a blank page in internet explorer) – katana_0 Sep 01 '17 at 06:57
  • Got it. so you just need one tutorial that will help you know how to work with VPython. – Jaffer Wilson Sep 01 '17 at 07:00
  • So the issue what you are facing might because of the python and vpython incompatbility. What OS you are using and what is the version of your Vpython? – Jaffer Wilson Sep 01 '17 at 07:03
  • @JafferWilson Nope. All tutorials begins their code by `from vpython import *`, and it does nothing here. Also, when I run the exact same code in my PC, nothing happens (Windows 10, VPython 7) – katana_0 Sep 01 '17 at 07:04
  • May I know from where you have downloaded the vpython? I do not see Vpython7 on the website. Only Vpython6. – Jaffer Wilson Sep 01 '17 at 07:06
  • @JafferWilson I went to cmd and typed `pip install vpython`, and after that, typed `pip install ipython`. That's what I read somewhere installed the latest version of Vpython (and I think its version 7) – katana_0 Sep 01 '17 at 07:07
  • @JafferWilson Check [this](http://vpython.org/index.html) – katana_0 Sep 01 '17 at 07:08

4 Answers4

2

I'm pretty sure that browser window is rendering your output. I've just installed vpython and when I type from vpython import * in the python console a browser window opens just like you said. After that I go back into my python console and type box() which draws a box inside that browser window.

Edit: I installed with conda install -c vpython vpython

orangeInk
  • 1,360
  • 8
  • 16
  • 1
    I'm just so dumb I thought the browser window was an error and closed it every single time insantly after it opened, and of course nothing happened. But now I see it works there, of course :) – katana_0 Sep 01 '17 at 07:13
  • Thanks a lot. BTW, How to change the default app for handling such links ? I have Internet Explorer set as default, I want to change it to chrome. – katana_0 Sep 01 '17 at 07:14
  • @AlexKChen you can change it by making your chrome as default from the control panel – Jaffer Wilson Sep 01 '17 at 07:17
  • Also just something I noticed today, while the `sphere` or `box` has the `pos` attribute, when you define a curve `c` in vpython, and then type `c.pos`, it shows `AttributeError: object does not have a "pos" attribute`. But the exact same thing works perfectly for sphere or box. But according to http://vpython.org/contents/docs/curve.html, curve has a pos attribute. – katana_0 Sep 01 '17 at 17:45
  • The documentation link you give is to an obsolete version of VPython. That link starts with this:This is documentation for Classic VPython (VPython 6), which continues to be available but is no longer supported. See vpython.org for information on installing VPython 7 or using GlowScript VPython. Documentation is available at glowscript.org by clicking Help. – user1114907 Oct 07 '19 at 17:23
2

I have tried installing the Vpython by opening the cmd with administrative permission.

Then I wrote the lines on python console:

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from vpython import *
>>> box()
<vpython.vpython.box object at 0x0497E770>
>>>

Here is the output what I got:

Vpython image

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
  • Also just something I noticed today, while the sphere or box has the pos attribute, when you define a curve c in vpython, and then type c.pos, it shows AttributeError: object does not have a "pos" attribute. But the exact same thing works perfectly for sphere or box. But according to vpython.org/contents/docs/curve.html, curve has a pos attribute. Any idea why this is happening ? – katana_0 Sep 01 '17 at 17:46
  • @AlexKChen It is not the part of the current question, my friend. You can post another question asking your queries, with the example you have tried and the output you got with the expected output. – Jaffer Wilson Sep 04 '17 at 02:32
0

At the start of http://vpython.org/contents/docs/curve.html is this important statement:

This is documentation for Classic VPython (VPython 6), which continues to be available but is no longer supported. See vpython.org for information on installing VPython 7 or using GlowScript VPython. Documentation is available at glowscript.org by clicking Help.

Since you are using the vpython module, you need to read the documentation for the vpython module (VPython 7). Here for example is the curve documentation:

http://www.glowscript.org/docs/VPythonDocs/curve.html

user1114907
  • 972
  • 8
  • 15
0

After importing vpython(don't close the browser(vpython window)) Check dir the of the vpython using command dir(vpython) it contains the HTTPserver and many other useful classes... check that out .. this may help you ..