Hi,
I tried to create 4 viewports on the screen at once.
I have the main viewport, and then
3 viewports on the side.
I used a simple keyboard callback function to
turn the viewports on and off.
Below is the code I am using.
Everything works fine up until I press a,s, or d 4 times. After
the fourth press, Vizard will crash.
Is this just sloppy implementation on my part?
Also, the next thing I will be working on when these
viewports stop crashing is making the viewport
lock in on whatever the previous view was.
Can I simply set the
viewpoint of the window
to the main cameras view
and update it every time there
is a keyboard event (which in my
case will only make the viewports
turn on and off).
~~Thanks,
George
Code:
################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Keyboard
################################################
def mykeyboard(key):
view = viz.add(viz.VIEWPOINT)
if key == 'a':
window1.visible(viz.TOGGLE) # Hide the window
elif key == 's':
window2.visible(viz.TOGGLE) # Hide the window
elif key == 'd':
window3.visible(viz.TOGGLE) # Hide the window
################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Objects
################################################
viz.add('outersphere.IVE')
viz.add('innersphere.IVE')
viz.add('plane.IVE')
window1 = viz.add(viz.WINDOW)
window1.position(0,1)
window2 = viz.add(viz.WINDOW)
window2.position(0,0.25)
window3 = viz.add(viz.WINDOW)
window3.position(1,0.25)
################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Callback
################################################
viz.callback(viz.KEYBOARD_EVENT,mykeyboard)