问题标签 [vpython]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3180 浏览

python - 32 位和 64 位 Python 会发生冲突吗?

可能重复:
我可以在 OS X 上现有的 32 位安装旁边安装 Python 2.7.1 64 位吗?

我有一台运行 10.7.3 Lion 的 MacBook Pro,默认安装了 Python 2.7 64 位。我需要一个名为 VPython 的程序用于我所在的物理课,而 VPython 网站说它不适用于 64 位 Python。所以我想知道我的 MacBook 上是否同时安装了 32 位和 64 位 Python 2.7,它们是否会发生冲突或导致问题。我知道我可以做 Python 3.1 版本的 VPython,但我认为教授给我们的大部分指令都是针对 Python 2.7 的。感谢您对此的任何帮助。

0 投票
1 回答
1238 浏览

python - 试图让两个质量相互绕行......得到奇怪的错误

基本上,我已经创造了质量,给了它们一些速度和动量,并且我试图使用重力使它们相互绕行(围绕它们的质心)。

这是我得到的错误:

0 投票
1 回答
951 浏览

python - Python:将 VPython 中的场景导出为通用 3D 矢量文件

有没有办法导出VPythonas DXF//DWG或者3DS其他常见的3D矢量格式绘制的场景?

0 投票
2 回答
1350 浏览

python - 由弹簧连接的两个质量...试图模拟飞行但遇到困难

我们有两个质量为 0.1kg 的质量,它们由一个刚性弹簧连接,k = 10^5 N/m。弹簧的静止长度(以及两个质量之间的初始距离)为 d0 = 0.15m

质量 1 具有初始速度 (2.77, 1.25, 0) m/s,而质量 2 具有初始速度 (1.25, 4, 0) m/s。

我想编写一个代码来模拟该系统在重力作用下的飞行,同时忽略空气阻力。我还想在系统的质心处放置第三个球体。

这是我到目前为止所写的:

Ft12 是从第 1 球到第 2 球的张力,而 Ft21 是从 2 到 1。当然,如果我得到准确的结果,我不会发布这个,但我什至没有得到我可以轻易得到的结果观察。屏幕很快就变黑了,我没有机会看到发生了什么。我基本上希望这个系统在重力的影响下被“抛出”,你可以想象 COM 的轨迹将是抛物线的轨迹。任何帮助将不胜感激。如果我弄错了力量,或者我需要在某些地方添加一些,请告诉我!

谢谢大家!

0 投票
4 回答
92 浏览

python - 操作列表以提高代码效率,苦苦挣扎

本质上,我想创建如下新变量:

...

...

在不更改planet列表的情况下,我将需要稍后在代码中访问“merc”、“venus”等。

0 投票
3 回答
424 浏览

python - 创建多个向量

所以假设我有一个数字列表,我想从所有这些数字中创建一个向量,格式为 (x, 0, 0)。我该怎么做?

所以当我访问时,比如说,hello[2]我得到(3, 0, 0)的不仅仅是3.

0 投票
1 回答
233 浏览

python - 在 vpython 中移动/隐藏按钮

如何在 VPython 中隐藏按钮或将其移出屏幕?我试过了:

这些似乎都不起作用。

0 投票
1 回答
1317 浏览

python - 在 VPython 中创建一个人脸?

在浏览了一些 VPython 的文档之后,我还没有找到一种简单的方法来从三点做一张脸,但我想我可能会遗漏一些东西。我在想象这样的事情:

也许我应该只使用不同的库。

0 投票
1 回答
1073 浏览

python - GTK window capture: VPython (OpenGL) application

Having read the documentation for VPython and GTK threading, it seems to me that it would be possible to embed VPython graphics within a gtk GUI. I know that it is possible with wx on Windows but I am on Linux and using PyGTK. Now, I have managed to get part of the way. I can embed a VPython window provided that it is spawned a separate process. What I would like is to embed it as a thread. The latter would make GUI events that control the OpenGL easier to implement -- via a thread instead of a socket and network calls.

Edit: Apparently nobody knows anything about this... Meh.

Here is the code I have. Uncomment the two commented out lines and comment a few obvious others and you can get to the process spawning code.

0 投票
3 回答
1999 浏览

python - Vpython绘制半球

我在我的程序上绘制了一个球体,如下所示:

有没有办法让它只显示球体的上半部分?

我正在使用 vpython。

谢谢,