View Single Post
  #2  
Old 04-11-2014, 06:12 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
Sure, <window>.setSize() works during runtime as well, so for finding the right window size by tweaking it step-by-step you can have a little code like this:

Code:
x = 0.5 #initial size window X
y = 0.5 #initial size window Y

upLeftWindow = viz.addWindow()
upLeftWindow.setSize([x,y])
upLeftWindow.setPosition(0,1)
upLeftWindow.clearcolor(viz.WHITE)

def onKeyDown(key):
	global x, y
	if key == '-': 
		x -= 0.05 #step size
		upLeftWindow.setSize([x,y])
	elif key == '=':
		x += 0.05 #step size
		upLeftWindow.setSize([x,y])
	print x, y

viz.go()

viz.callback(viz.KEYDOWN_EVENT,onKeyDown)
Pressing - or = will increase or decrease the X size of the window, you can map other keys for the Y size in a similar fashion.
Reply With Quote