【问题标题】:Vpython userspin does not workVpython userspin 不起作用
【发布时间】:2017-04-09 15:27:14
【问题描述】:

我在按钮单击时调用了一个函数,用于显示多个长方体。但是我希望能够在用户鼠标拖动时旋转我的框架以获得所需的视角(用户喜欢) 但是,我似乎无法在显示窗口上旋转和缩放。

编辑:我发现右键单击拖动它会改变视角。然而它并没有得到反映。奇怪的是,它只有在我最大化然后恢复屏幕后才会反映出来。我可以做一些设置来让它无缝工作吗? 此外,第一次显示发生在我将窗口从其初始位置移动之后。否则它在启动时只是空白!请指教

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

【问题讨论】:

    标签: python graphics tkinter 3d vpython


    【解决方案1】:

    我不明白“它没有得到反映”是什么意思。它是什么”?另外,您还没有提供可运行的程序,因此很难知道上下文是什么。

    我会宣传,在 VPython 论坛中提出 VPython 问题的更好地方

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

    【讨论】:

      猜你喜欢
      • 2016-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-13
      • 1970-01-01
      相关资源
      最近更新 更多