[visionegg] Re: Exiting a While Loop
- From: "Maher, Jeffrey" <jeffrey.maher@xxxxxxxxxxxxx>
- To: <visionegg@xxxxxxxxxxxxx>
- Date: Wed, 1 Aug 2007 09:38:37 -0500
Andrew,
I see what you are talking about with the mouseTarget.py, but with my limited
knowledge I have no idea how to implement it into the code that I have in front
of me.
I tried just using the code from there into mine, but that didn't have a very
desirable outcome. I would love to be able to show you all the code, but it is
far too long to put in an email. It seems as though the presentation class
maybe isnt used for this?
Is it possible to apply the callback into the while loop that I have so it will
work? One of the things I've found thats weird is that p is never defined
before hand, yet for some reason it still works in that code. When I attempt to
define p up above to use the callback function it changes what is shown on the
screen.
One thing I did notice is that in your ephysgui you have a cancel button, but I
can't for the life of me seem to find the code for it. Any chance you might be
able to direct me to that? That appears to be my next alternative means of
getting out of the while loop.
-Jeff
________________________________
From: visionegg-bounce@xxxxxxxxxxxxx on behalf of Andrew Straw
Sent: Tue 31-Jul-07 6:48 PM
To: visionegg@xxxxxxxxxxxxx
Subject: [visionegg] Re: Exiting a While Loop
Dear Jeff,
If you're not dealing with events in p.go(), they will very likely never
be seen by your code. Check the mouseTarget.py demo for an example of
setting up callbacks to deal with events within the go() loop.
Let us know if you're still stuck.
-Andrew
Maher, Jeffrey wrote:
> 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
======================================
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