psychopy and pygame

784 views
Skip to first unread message

js

unread,
Aug 15, 2010, 12:17:29 PM8/15/10
to psychopy-users
Hi,

So far, I've written my experiments in python, using pygame. I'm
thinking about integrating some of the very very nice stuff from
psychopy, but I also would hate not to be able to re-use the functions
I already have. So my questions are:
1- How do I mix pygame functions with psychopy? How do I go from a
pygame surface to a psychopy window (and the other way around, too).
2- I'm under ubuntu 10.04, with the latest version of psychopy, and
the psychopy window function does not seem to support the option
winType='pygame'. Is it a known bug?

Cheers,

Jérome

Jonathan Peirce

unread,
Aug 15, 2010, 12:40:32 PM8/15/10
to psychop...@googlegroups.com

On 15/08/2010 17:17, js wrote:
> Hi,
>
> So far, I've written my experiments in python, using pygame. I'm
> thinking about integrating some of the very very nice stuff from
> psychopy, but I also would hate not to be able to re-use the functions
> I already have. So my questions are:
> 1- How do I mix pygame functions with psychopy? How do I go from a
> pygame surface to a psychopy window (and the other way around, too).

I'm afraid the psychopy window is a pygame display with OpenGL support,
which wasn't compatible with pygame surfaces last I checked. But a) that
might have changed and b) it might have been on windows (where surfaces
are rendered using a DirectX backend).

What sort of things are you drawing?
What are the functions that you would be sad to lose?
If they're handy, maybe we can add them to PsychoPy (using OpenGL
instead of pygame commands) ;-) But it might be that you're doing
something that PsychoPy can already do.


> 2- I'm under ubuntu 10.04, with the latest version of psychopy, and
> the psychopy window function does not seem to support the option
> winType='pygame'. Is it a known bug?

Not known to me. What are the symptoms of 'does not seem to support'?

Jon

--
Dr. Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk/

Jerome Sackur

unread,
Aug 15, 2010, 4:53:20 PM8/15/10
to psychop...@googlegroups.com
Thanks for your very quick answer. There are mainly two things I would miss: 1- response scales, where the observer moves a cursor on a continuous scale to give his / her response; 2- some textures that I used to create directly through numarrays.

The other thing is the following: when in the demo codes I set winType='pygame' in the main window declaration, I get an empty gray window, without stimuli. When I get back to pyglet, i works nicely.

cheers,

Jérôme

--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To post to this group, send email to psychop...@googlegroups.com.
To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/psychopy-users?hl=en.


Jeremy Gray

unread,
Aug 15, 2010, 5:57:00 PM8/15/10
to psychop...@googlegroups.com
Hi Jérôme,

Thanks for your very quick answer. There are mainly two things I would miss: 1- response scales, where the observer moves a cursor on a continuous scale to give his / her response;

as luck would have it, rating scales are now available in svn. (this is not yet documented on the web, nor available in the stand-alone releases but will be eventually). there's a demo called ratingScale.py (also in svn), see the Coder demo menu. there are a lot of options, including effectively continuous ratings (or 1-to-7 discrete ratings), using the mouse to respond, and so on. you can ask the subject to rate more or less anything, even dynamic stimuli such as movies.

I can't speak to the other two things you'd miss.

--Jeremy

 

Jon Peirce

unread,
Aug 16, 2010, 4:48:57 AM8/16/10
to psychop...@googlegroups.com


On 15/08/2010 22:57, Jeremy Gray wrote:
Hi Jérôme,

Thanks for your very quick answer. There are mainly two things I would miss: 1- response scales, where the observer moves a cursor on a continuous scale to give his / her response;

as luck would have it, rating scales are now available in svn. (this is not yet documented on the web, nor available in the stand-alone releases but will be eventually).
I'm hoping to release a version with this very soon (tomorrow?)


2- some textures that I used to create directly through numarrays.

This is already directly available, using the PsychoPy PatchStim (assuming you're refering to the modern numpy, not the previous library that was called numarray). Have a look at the demos visual_noise and customTextures. Both are creating custom numpy arrays to provide as textures. The bonus that you get with these that you don't with the pygame surface is the mask (the noise array can be drawn behind a circle or gauss or another numpy array).

The other thing is the following: when in the demo codes I set winType='pygame' in the main window declaration, I get an empty gray window, without stimuli. When I get back to pyglet, i works nicely.

Could you let us know what version of pygame you're using? Critically, is it less than 1.8? I have some vague memory that pygame's default scaling changed a while back (whic might mean your stimuli are all being drawn smaller than the central pixel on the screen).

all the best
Jon

This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

Jerome Sackur

unread,
Aug 17, 2010, 5:03:21 PM8/17/10
to psychop...@googlegroups.com
Thanks a lot for your answers. I will try and get back to you if need be!

J.

--
Jérôme Sackur

Laboratoire de Sciences Cognitives et Psycholinguistique (ENS/CNRS/EHESS)
Département d'Etudes Cognitives
Ecole Normale Supérieure
29, rue d'Ulm --- Pavillon Jardin
75005 Paris, France
tel.: + 33 (0) 1 44 32 26 25
fax: + 33 (0) 1 44 32 26 30
email: jerome...@gmail.com


--
Reply all
Reply to author
Forward
0 new messages