简体   繁体   English

VPython Userspin不起作用

[英]Vpython userspin does not work

I have a function call on button click which is used to display a number of cuboids. 我在按钮单击上有一个函数调用,该函数用于显示许多长方体。 However i want the ability to rotate my frame on user mouse drag so as to get the desired viewing angle (as preferred by user) However, i cant seem to rotate as well as zoom on my display window. 但是,我希望能够在用户拖动鼠标时旋转我的框架,以便获得所需的可视角度(用户喜欢)。但是,我似乎无法在显示窗口上旋转以及缩放。

Edit: What i found was upon a right click drag it changes the viewing angle. 编辑:我发现是在右键单击上拖动它改变了视角。 However it does not get reflected. 但是它并没有得到反映。 Weirdly enoughn it is reflected only after i maximize and then restore the screen. 奇怪的是,只有在我最大化然后恢复屏幕之后,它才会反映出来。 Is there some setting i can do to make it work seamlessly. 我可以做一些设置以使其无缝运行吗? Also, the first display happens after i move the window from its initial position. 另外,在我将窗口从其初始位置移开之后,第一次显示会发生。 Else its just blank upon launch!! 否则它在发布时只是空白! Please advise 请指教

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']]

I don't understand what is meant by "it does not get reflected". 我不明白“它没有得到反映”的含义。 What is "it"? 它是什么”? Also, you haven't provided a runnable program, so it' difficult to know what the context is. 另外,您还没有提供可运行的程序,因此很难知道上下文是什么。

I'll advertise that a better place to pose VPython questions is in the VPython forum at 我会在VPython论坛上发布广告,提出一个更好的解决VPython问题的地方

https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM