PDA

View Full Version : vizinfo show/hide/toggle


sl0bz
06-03-2009, 07:34 AM
I have a gamepad controller. Right now, all I am trying to do is program one button on the controller that will show the info bar when the button is pressed and program a different button on the controller to hide the info bar when the button is pressed. I am able to get the info bar to show with a button press, but the vizinfo.visible(0) command will not hide the bar.

The ultimate goal is to program a single button where the info bar will only show up when the button is being held down and disappears when the button is released.

We have tried a bunch of different variations of the code, but have been unsuccessful.

Any help would be nice. Thanks in advance :cool:

Here is a cut of my code:
def InfoBar(e):
#Get the state of the buttons on joystick
state = joy.getButtonState()

#ADD Info Bar
info = vizinfo.add('Sample Text')
info.title('DEMO CONTROLS')
info.visible(0)
if state & vizjoy.BUTTON9:
info.visible(1)
if state & vizjoy.BUTTON10:
info.visible(0)
viz.callback(vizjoy.BUTTONDOWN_EVENT, InfoBar)

Jeff
06-04-2009, 10:59 AM
You should add your vizinfo box before your function definition. The way it is there, every time you call your InfoBar function another info box is created that's only accessible within that function call.

sl0bz
06-04-2009, 11:41 AM
thanks for the reply!

it worked once we took the vizinfo definition out of the function definition.

bogus mistake on our part