Vpython簡單例子

2022-03-13 02:41:04 字數 755 閱讀 4030

vpython簡單例子

首先開啟「vidle for vpython」

vpython的例子在e:\python27\lib\site-packages\visual\examples(視安裝軟體的路徑不同而不同)

e.g.1 (知識點:向量、三維座標)

bounce.py

from visual import *  #引入視覺化包中的類

floor = box(length=4, height=0.5, width=4, color=color.blue)#定義「地板」的長、寬、高和顏色

ball = sphere(pos=(0,4,0), color=color.red)  #定義球的大小和顏色

ball.velocity = vector(0,-1,0)  #定義球運動路線向量座標

dt = 0.01 

while 1:

rate(100)  #定義速率

bounce.py的3d執行結果

簡單委託例子

例子1 using system using system.collections.generic using system.text 例子2 using system using system.collections.generic using system.text namespace 介面 c...

Pro C 簡單例子

include exec sql begin declare section char userid 11 hr oracle char std name 10 int std number int dept number exec sql end declare section char temp...

TabLayout簡單例子

要生成乙個tab ui需要用到兩個類,乙個是tabhost,乙個是tabwidget.tabwidget是用來顯示標籤欄的,內嵌在tabhost裡面。首先建立以tabhost為根節點的xml布局檔案 生成三個對應於標籤內容的activity pictureactivity public class ...