WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 09-28-2006, 11:04 AM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Ok, that worked, now the next step is for the program to recognize which button is pushed. Here is the code I have so far:
Code:
def mybutton(button,state):
 global SendText, infoindex, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve
 letter = ''
 if button == send and button.get() == viz.DOWN:
  #Send the current text to the mailbox
  #Reset the text to nothing
  SendText = ''
  text.message(SendText)
  if infoindex <= 15:
   info.visible(1)
   infoindex = infoindex + 1
   one.remove(viz.BUTTON_LABEL)
   two.remove(viz.BUTTON_LABEL)
   three.remove(viz.BUTTON_LABEL)
   four.remove(viz.BUTTON_LABEL)
   five.remove(viz.BUTTON_LABEL)
   six.remove(viz.BUTTON_LABEL)
   seven.remove(viz.BUTTON_LABEL)
   eight.remove(viz.BUTTON_LABEL)
   nine.remove(viz.BUTTON_LABEL)
   ten.remove(viz.BUTTON_LABEL)
   eleven.remove(viz.BUTTON_LABEL)
   twelve.remove(viz.BUTTON_LABEL)
  elif infoindex > 15:
   text.visible(0)
   button.visible(0)
   HEAD_DEPTH = -12.5
   viz.translate(viz.HEAD_POS,0,0,HEAD_DEPTH )
   instructor1 = viz.add('male.cfg')
   instructor1.face('biohead_talk.vzf')
   instructor1.threatening = INSTRUCTOR
   instructor1.tag = 0
   instructor1.appearance = 0
   instructor1.facepic = 0 
   Instructions(instructor1)
   info.visible(0)
   #bulletinfo.visible(1)
 if viz.add(viz.BUTTON_LABEL,'a') and state == viz.DOWN:
  letter = 'a'
 elif viz.add(viz.BUTTON_LABEL,'b') and state == viz.DOWN:
  letter = 'b'
 elif viz.add(viz.BUTTON_LABEL,'c') and state == viz.DOWN:
  letter = 'c'
 elif viz.add(viz.BUTTON_LABEL,'d') and state == viz.DOWN:
  letter = 'd'
 elif viz.add(viz.BUTTON_LABEL,'e') and state == viz.DOWN:
  letter = 'e'
 elif viz.add(viz.BUTTON_LABEL,'f') and state == viz.DOWN:
  letter = 'f'
 elif viz.add(viz.BUTTON_LABEL,'g') and state == viz.DOWN:
  letter = 'g'
 elif viz.add(viz.BUTTON_LABEL,'h') and state == viz.DOWN:
  letter = 'h'
 elif viz.add(viz.BUTTON_LABEL,'i') and state == viz.DOWN:
  letter = 'i'
 elif viz.add(viz.BUTTON_LABEL,'l') and state == viz.DOWN:
  letter = 'l'
 elif viz.add(viz.BUTTON_LABEL,'m') and state == viz.DOWN:
  letter = 'm'
 elif viz.add(viz.BUTTON_LABEL,'n') and state == viz.DOWN:
  letter = 'n'
 elif viz.add(viz.BUTTON_LABEL,'o') and state == viz.DOWN:
  letter = 'o'
 elif viz.add(viz.BUTTON_LABEL,'p') and state == viz.DOWN:
  letter = 'p'
 elif viz.add(viz.BUTTON_LABEL,'r') and state == viz.DOWN:
  letter = 'r'
 elif viz.add(viz.BUTTON_LABEL,'s') and state == viz.DOWN:
  letter = 's'
 elif viz.add(viz.BUTTON_LABEL,'t') and state == viz.DOWN:
  letter = 't'
 elif viz.add(viz.BUTTON_LABEL,'u') and state == viz.DOWN:
  letter = 'u'
 elif viz.add(viz.BUTTON_LABEL,'v') and state == viz.DOWN:
  letter = 'v'
 elif viz.add(viz.BUTTON_LABEL,'x') and state == viz.DOWN:
  letter = 'x'
 elif viz.add(viz.BUTTON_LABEL,'y') and state == viz.DOWN:
  letter = 'y'
 elif viz.add(viz.BUTTON_LABEL,'z') and state == viz.DOWN:
  letter = 'z'
 SendText += letter
 text.message(SendText)
The problem I'm having is that no matter what button I push, an "a" is printed in text. Am I doing something wrong? Is it ok to use the if viz.add() to implement this? The way I see this code is that whatever button (letter) I press, that letter should be the next one to pop up. In other words, how can I access the BUTTON_LABEL attribute to use it in my if logic.

Last edited by betancourtb82; 09-28-2006 at 11:56 AM.
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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