![]() |
|
#1
|
|||
|
|||
![]()
Hi,
I am trying to build an application with radio buttons activated by keyboard instead of mouse. I am using these lines def onKeyDown(key): if key == 'A': aRadio.visible(1) aans = aRadio.get() print aans But, say there is another OK button if key == 'D': OKbutton.visible(0) dans = OKbutton.get() print dans Now, I am trying, if an user presses the A and D button in succession, then I want some response. if key == 'A': aRadio.visible(1) aans = aRadio.get() print aans if key == 'D': OKbutton.visible(0) dans = OKbutton.get() print 'abcd' But, it is not printing out 'abcd'. Can anyone suggest where I am going wrong or is there is any better way? Thanks in advance for the sugestion Uttama |
#2
|
|||
|
|||
Hi,
I have used a counter and this solves my problem. But, I don't know, why nested if loop is not sensing. Thanks Uttama |
#3
|
|||
|
|||
Hi,
Does nested if loop work in Vizard (particularly while using two buttons of keyboard or a keyboard button and a variable value)? If somebody has some suggestion....it would be really helpful to me. Thanks Uttama |
#4
|
|||
|
|||
Python supports nested loops. Here is a sample:
Code:
for x in range(5): for y in range(5): print x,y |
#5
|
|||
|
|||
Hello,
I was trying by using nested if loop: aRadio = QuestionBox.add(viz.RADIO, 0, "A. 1") bRadio = QuestionBox.add(viz.RADIO, 0, "B. 2") cRadio = QuestionBox.add(viz.RADIO, 0, "C. 3") OKbutton = QuestionBox.add(viz.BUTTON, "OK") def onKeyDown(key): if key == 'A': if key == 'D': print 'abcd' viz.callback(viz.KEYDOWN_EVENT,onKeyDown) Here, A is my first option and D is my OK button. So, what I want is if the user presses A and subsequently D (i.e. OK button), I must print something say 'abcd'. Are there further options available for consecutive keyboard entries? Thanks Uttama |
#6
|
|||
|
|||
Hello,
The help file does not show any options for consecutive keyboard entries. Thanks Uttama |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Menu Options | south_bank | Vizard | 5 | 07-07-2008 10:52 AM |
What are the options for making a movie of a Vizard world? | Karla | Vizard | 1 | 05-13-2008 10:56 AM |
On Screen Keyboard | betancourtb82 | Vizard | 14 | 10-03-2006 12:38 PM |
Multiple Viewports in Vizard, Utilizing keyboard callback | shivanangel | Vizard | 2 | 02-21-2006 04:56 PM |
Timer vs. Keyboard input | Wenamun | Vizard | 1 | 01-23-2006 09:04 PM |