WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Display a variable in main graphics window (https://forum.worldviz.com/showthread.php?t=4804)

laker 09-13-2013 02:21 PM

Display a variable in main graphics window
 
How can I display the current value of a variable? All I need is something that works like the print statement but prints to the graphics window not the input/output window. Text boxes and dialogue boxes can show content but, as far as I can see, the content can't be a variable - it can only be a text string. Any tips appreciated!

Kevin Chiu 09-16-2013 05:35 AM

Hi,

As Vizard is Python based, you actually can use Python's function to convert your variable to a string and show it in a text box or dialogue box.

Please try this simple sample:
Code:

import viz

viz.go()

a = 10
b = 3

box = viz.addTextbox()
box.setPosition(.5,.5)
box.message(str(a + b))


laker 09-17-2013 12:56 PM

Thank you Kevin - good of you to take the trouble.


All times are GMT -7. The time now is 07:15 PM.

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