2017-04-09 18 views
0

我有一個按鈕單擊的函數調用,用於顯示一些長方體。不過,我希望能夠旋轉我的框架上的用戶鼠標拖動,以獲得所需的視角(用戶首選) 但是,我似乎不能旋轉,以及放大我的顯示窗口。Vpython userspin不起作用

編輯:我發現是右鍵單擊拖動它改變視角。但它沒有得到體現。奇怪的是,它只有在我最大化然後恢復屏幕後纔會反映出來。是否有一些設置可以使其無縫工作。 此外,第一次顯示發生在我將窗口從其初始位置移開後。發佈時只有空白!請告知

def testDraw(): 
    global containers 
    myscene = display(title='Diagram') 
    #myscene.material = materials.wood 
    myscene.select() 
    myscene.exit=False 
    #myscene.userspin = True 
    myscene.userspin = 1 
    myscene.forward = (.1, -.3, -1) 
    mybox = [['','','','','','','',''] for x in range(len(containers))] 
    for x in range(len(containers)): 
     for y in range(len(containers[x])): 
      mybox[x]=box(pos=(float(containers[x][1])+float(containers[x][2])/2,float(containers[x][3])+float(containers[x][4])/2,float(containers[x][5])+float(containers[x][6])/2),width=float(containers[x][6]),height=float(containers[x][4]),length=float(containers[x][2])) 
    #,color='color.'+containers[x][7] 
    #mybox = box(pos=(2.5,1,5), length=10, height=2, width=5,color=color.blue) 
    #mybox2 = box(pos=(12.5,1,5), length=10, height=2, width=5,color=color.green) 

#Name,length0,length1,height0,height1,width0,width1,color 
containers=[['Container_1','`enter code here`0','2','0','7','0','2','blue'], 
      ['Container_2','2','5','0','10','0','2','green'], 
      ['Container_3','7','10','0','5','0','2','red']] 

回答