简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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