[visionegg] Exiting a While Loop
- From: "Maher, Jeffrey" <jeffrey.maher@xxxxxxxxxxxxx>
- To: <visionegg@xxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 13:37:12 -0500
Hello all,
Yes I know this is a repeat to my previous question, and I apologize for that.
I have made some progress in the code, now I need is a slight bit of debugging
and advice.
As a reminder, my problem is that I could not get the while loop to terminate
prior to the set value being reached.
Previously I was not able to get the code for trapping a keypress into the
while loop, and while now that I have, it seems unable to read the code and
simply jumps over it to the other conditions of the while loop. In the code
below, it appears as though the for loop is completely ignored.
If I try bumping the p.go and i=i+1 an indent over, I get random number of
stimulus presentations, and the the keypress seeems to (MAYBE) make a
difference. I have also tried using an else statement, but that seemed to reset
the value of i and again produce a random number of time the stimulus is
presented.
Heres the code:
i=0
while i!=eval(self.number.get()):
for event in pygame.event.get():
if event.type == pygame.locals.KEYDOWN:
if event.key == pygame.locals.K_UP:
i=self.number.get()
p.go()
i=i+1
Any suggestions would be much appreciated.
-Jeff
=====================================The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: Exiting a While Loop
- From: Andrew Straw
Other related posts:
- » [visionegg] Exiting a While Loop
- » [visionegg] Re: Exiting a While Loop
- » [visionegg] Re: Exiting a While Loop
- » [visionegg] Re: Exiting a While Loop
- [visionegg] Re: Exiting a While Loop
- From: Andrew Straw