[visionegg] Re: fixation viewport
- From: "Gabriel Nevarez" <nevarezg@xxxxxxxxxxxxx>
- To: <visionegg@xxxxxxxxxxxxx>
- Date: Fri, 18 Mar 2005 19:22:20 +0000
Hi Darren,
No offence taken at all! I was at the same stage you were not long ago, and
after MANY sleepless nights I was finally able to kludge together some decent
studies. Still, since VisionEgg is a work-in-progress, much of the black magic
is still done through trial and error. I was simply suggesting a way that we
could gather much of this trial and error and put it in one place, rather than
having to reinvent the wheel or surf the various python newgroups endlessly for
some glimmer of hope to what is usually a trivial solution.
I *do* think having a good working knowledge of python and python's class
structure will make things much easier, but that comes with practice... check
out the docs on python.org's site, in addition to the pygame docs and
games/utilities on the site.
In regards to an answer to your direct question:
A fixation spot can be done with:
fixation_point = FixationSpot(color = (1.0, 1.0, 1.0),
position = (screen.size[0] / 2, screen.size[1] /
2),
size = (4.0, 4.0) )
Then, per Tim's suggestion, add the fixation spot to whatever viewport you
have. I usually create the viewport sans stimuli:
viewport = Viewport(screen=screen)
Then, as necessary, I change the viewport stimuli as such:
viewport.parameters.stimuli = [fixation_point] + [arbitary_stimuli]
To answer another question you had, if I need to show one stimulus after
another, I will do something like:
## assume "arbitrary_stimuli_x" are stimuli that have already been instantiated
viewport.parameters.stimuli = [fixation_point] + [arbitary_stimuli_1]
drawScreen()
delay(1000)
viewport.parameters.stimuli = [fixation_point] + [arbitary_stimuli_2]
drawScreen()
delay(1000) ## using pygame.time.delay()
Then create your own drawScreen(), such as:
def drawScreen():
screen.clear()
viewport.draw()
swap_buffers()
frame_timer.tick()
Hope this helps.
-=Gabriel Nevarez
Research Programmer
Psychology Department
Cardiff University
http://www.cf.ac.uk/psych
>>> darrenleeweber@xxxxxxxxx 18/03/05 6:12 PM >>>
Yes, that would be nice, but how about answering my question? Do I
have to search all over the python world to find this too? I have
started using python, after many years of working with perl and
recently matlab. I have some idea of object oriented programming and
I realise that this particular problem seems so simple to solve. I
expected to read the class documentation, find the right
variable/parameter to set and then just set it. However, it was not
solved in 5 minutes and I'm not sure what the next step is. Maybe I
need to learn more about the python class and parameter setting
process. I was wondering if I have to use create_screen() rather than
get_default_screen() just so I can set the screen background color. I
figure that screen background color should be a dynamic variable, so I
was hoping that screen.bgcolor was something I could set. Not so
simple, Mr Magoo :-o
On Fri, 18 Mar 2005 17:58:27 +0000, Gabriel Nevarez
<nevarezg@xxxxxxxxxxxxx> wrote:
> Hi, Andrew and all,
>
> It might be a good idea to add a section to the VisionEgg web site with
> actual implemented studies (contributed by volunteers), in addition to the
> standard demos. This would aid with some of these questions, in addition to
> lowering the bar for newbies wanting to try out VisionEgg. At the very
> least, the addition of code templates for common psychophysical study-types,
> such as RSVP or multiple-object tracking, might be useful.
>
> As a research programmer, I have the luxury of dedicating myself to scowering
> the related python newgroups and lists and trying things out on my own, but
> many of my psychologist colleagues don't have either the time or programming
> knowledge to do this... in effect, the very reason tools like VisionEgg exist
> (to make psychophysical studies easier to implement!)
>
> I know I've had many of these same questions when I first started coding in
> python/VisionEgg, and I learned as everybody else does... by example.
>
> cheers,
> -=Gabriel Nevarez
> Research Programmer
> Psychology Department
> Cardiff University
> http://www.cf.ac.uk/psych
>
> >>> darrenleeweber@xxxxxxxxx 18/03/05 5:42 PM >>>
> Hi,
>
> the construct
>
> screen = get_default_screen()
>
> creates a gray screen. The reference documentation for the screen
> class indicates that it has a bgcolor parameter. I've tried a number
> of ways to set it, without success. How do we set this parameter? I
> want, bgcolor = (0.0, 0.0, 0.0), rather than the default gray.
>
> Best, Darren
> ======================================
> 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
>
======================================
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
Other related posts: