Embed Vpython Canvas in Wxpython or tkinter

155 views
Skip to first unread message

Muhammad Nafees

unread,
Dec 30, 2020, 11:55:25 AM12/30/20
to Glowscript Users
Hi,

Is it possible to embed the vpython 3d canvas within tkinter or wxpython? If so could anyone guide me as to how to do it?

Regards,
Nafees


Bruce Sherwood

unread,
Dec 30, 2020, 12:23:18 PM12/30/20
to Glowscript Users
I'm guessing that this is not possible, in particular because the tkinter or wxpython event-handling mechanisms would clash with VPython's mechanisms.

Note that VPython does provide a decent set of widgets. Here are a couple of examples:



Here is the widget documentation: https://www.glowscript.org/docs/VPythonDocs/controls.html

Bruce

Muhammad Nafees

unread,
Dec 30, 2020, 2:05:03 PM12/30/20
to glowscri...@googlegroups.com
Hi Bruce,
That makes sense. Another quick question, can I use pandas with Glowscript? I want to save the coordinates in a csv file or compare them. If not pandas, what could I use?

--

---
You received this message because you are subscribed to a topic in the Google Groups "Glowscript Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/glowscript-users/rQgY-vyaRTY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to glowscript-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glowscript-users/CA%2BWuaSdNqxPjogwrbfviXnLA%3DTpx0b--ZiQHTYLdsDS6z8xzYQ%40mail.gmail.com.

Bruce Sherwood

unread,
Dec 30, 2020, 3:14:39 PM12/30/20
to Glowscript Users
First I need to explain that GlowScript VPython is compiled to JavaScript in the browser and executed in the browser, so it isn't possible to import Python modules (a partial exception is that many of the random functions are available). It is possible to import modules that are written in JavaScript. I don't know whether there exists a JavaScript library similar to pandas.

I think what you are looking for is VPython 7, which uses installed Python, which means that you can import pandas or numpy or any such module (but presumably not tkinter nor wxpython, as I explained). The VPython syntax is the same as with GlowScript VPython. VPyhon 7 opens a web browser page and uses the GlowScript library to produce the 3D animations. 

To install the vpython module for use with installed Python, see vpython.org. Please use the VPython 7 forum for questions related to its use: https://groups.google.com/g/vpython-users

Bruce

Reply all
Reply to author
Forward
0 new messages