VPython 三维显示 —— hello word

使用VPython,python(x,y)中已安装VPython模块

  1. from visual import *
  2. cylinder(pos=(0,1,0), axis=(0,1,0), radius=0.1, color=(0,1,0))
  3. box = box(length=4, height=0.5, width=4, color=color.blue)
  4. ball = sphere(pos=(0,4,0), color=color.red)

窗口交互

  • 拖动右键切换角度(rotate)
  • 同时按住左键右键拖动缩放窗口 (和滚轮缩放不同……)

主要资料

官网doc

http://vpython.org/contents/docs/display.html

官网示例代码

安装目录下文件夹中





原文地址:https://www.cnblogs.com/fly2wind/p/5943970.html