WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   vizinfo in multiple scenes (

vadrian 01-30-2005 06:20 PM

vizinfo in multiple scenes
hi, im trying to use the vizinfo module but the boxes only seem to appear in scene 1.
how can I add an info box to a different scene (while in another one)?
or how can I make a box appear after calling viz.scene(#>1) ?


farshizzo 01-31-2005 10:06 AM


Do you want the same box in different scenes? If so, try the following:

info = vizinfo.add(....)
#Duplicate the box onto scene 2

If you have an older version then try this instead:
I think you asked a question a few months ago about adding checkboxes and sliders to the vizinfo box. Version 2.5 of Vizard now allows you to do this, you might want to check it out.

vadrian 02-02-2005 01:10 PM

how should i do it if I want to add multiple vizinfos into different scenes (at least 2 per scene).

also, is there a way I can check the version number of vizard so i can send an error message if the user tries to run a script in an older version?

farshizzo 02-02-2005 01:16 PM


To add the vizinfo box to a different scene try the following:

#Place info box in scene 2

The following command will return a string that specifies the current version of Vizard:

version = viz.version()

vadrian 02-02-2005 02:11 PM

so i tried what you suggested, but it doesn't seem to work. i even made a little test script:


import viz
import vizinfo


info = vizinfo.add('message')

scene = 1
def onkeydown(key):
        global info, scene
        #The keyboard button 'key' is being pressed
        if key == ' ':
                scene += 1
        if key == 'd':
        if key == 'm':
                info._group.parent(viz.WORLD, scene)


farshizzo 02-02-2005 02:20 PM

My bad, it should be:

info._group.parent(viz.SCREEN, scene)

vadrian 02-02-2005 08:21 PM

ok, so the parent trick works (maybe this should be added as a feature in future versions?). now i get an error when i try to scale vizinfo. what i have is this:


INFO_SIZE = [0.5,0.5]
info = vizinfo.add('blah')

what I get is this:

Traceback (most recent call last):
    File "", line 12, in ?
    File "", line 123, in ?
TypeError: scale() takes exactly 3 arguments (2 given)

farshizzo 02-03-2005 10:19 AM

The older version of vizinfo didn't support passing lists to the scale function. You will have to pass each value individually:

or you could also do the following:


vadrian 02-03-2005 10:32 AM

i have both 2.5 and the previous version (2.1?) installed. I was getting that error while using 2.5. Is it possible vizard was grabbing the vizinfo from the older version?

also, random python question. is there a python equivalent to:

x = (isBoolean)? y:z

i have a lot of checks, and i'm tired of repeating the 4 line if/else template ;)

farshizzo 02-03-2005 10:49 AM

It might be possible. Startup 2.5 and check the value of the following in the interactive window:

It should point to "C:\Program Files\Vizard25" or wherever you installed 2.5

Python doesn't support the one line if/else. If you can guarentee that the value of the boolean will always be either 0 or 1 you could do the following:

x = [z,y][isBoolean]
Otherwise you could create your own function:

def ifelse(boolean,trueVal,falseVal):
        if boolean:
                return trueVal
        return falseVal

x = ifelse(isBoolean,y,z)

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

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