WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   vizdlg Panel Size (https://forum.worldviz.com/showthread.php?t=5669)

Martina 03-24-2016 06:44 AM

vizdlg Panel Size
 
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:

Code:

import viz
import vizshape
import vizdlg

viz.go()

myPanel = vizdlg.Panel(align=viz.ALIGN_LEFT_BOTTOM)
row = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_BOTTOM,border=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()



All times are GMT -7. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC