Log in

View Full Version : vizdlg Panel Size


Martina
03-24-2016, 06:44 AM
Hi,

I'm looking to get the size of an auto-scaled vizdlg Panel (I need its length and height). Is there a way to do this?

Best,
Martina

Jeff
03-25-2016, 08:45 PM
I'm not sure but will look into it. Can you post example code you're using to scale the panel?

Jeff
03-27-2016, 10:22 PM
Use the Panel.getBoundingBox method to get the panel dimensions:

import viz
import vizshape
import vizdlg

viz.go()

myPanel = vizdlg.Panel(align=viz.ALIGN_LEFT_BOTTOM)
row = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_BOTTOM,bord er=False,background=False,margin=0)
row.addItem(viz.addText('Textbox'))
textbox = row.addItem(viz.addTextbox())
myPanel.addItem(row)

circle = vizshape.addCircle(parent=viz.ORTHO,scale=[20,20,1],color=viz.RED)

def showPanelDimensions():
box = myPanel.getBoundingBox()
width = box.width
height = box.height
print width,height
circle.setPosition([width,height,0])

myPanel.setPanelScale(2)
showPanelDimensions()