| Home | Trees | Indices | Help |
|
|---|
|
|
Used to set up a context in which to draw objects, using either PyGame (python's SDL binding) or pyglet.
The pyglet backend allows multiple windows to be created, allows the user to specify which screen to use (if more than one is available, duh!) and allows movies to be rendered.
Pygame has fewer bells and whistles, but does seem a little faster in text rendering. Pygame is used for all sound production and for monitoring the joystick.
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| Method Details |
:Parameters:
size : (800,600)
Size of the window in pixels (X,Y)
pos : *None* or (x,y)
Location of the window on the screen
rgb : [0,0,0]
Color of background as [r,g,b] list or single value. Each gun can take values betweeen -1 and 1
fullscr : *None*, True or False
Better timing can be achieved in full-screen mode
allowGUI : *None*, True or False (if None prefs are used)
If set to False, window will be drawn with no frame and no buttons to close etc...
winType : *None*, 'pyglet', 'pygame'
If None then PsychoPy will revert to user/site preferences
monitor : *None*, string or a `~psychopy.monitors.Monitor` object
The monitor to be used during the experiment
units : *None*, 'norm' (normalised),'deg','cm','pix'
Defines the default units of stimuli drawn in the window (can be overridden by each stimulus)
See :ref:`units` for explanation of options.
screen : *0*, 1 (or higher if you have many screens)
Specifies the physical screen that stimuli will appear on (pyglet winType only)
viewScale : *None* or [x,y]
Can be used to apply a custom scaling to the current units of the :class:`~psychopy.visual.Window`.
viewPos : *None*, or [x,y]
If not None, redefines the origin for the window
viewOri : *0* or any numeric value
A single value determining the orientation of the view in degs
waitBlanking : *None*, True or False.
After a call to flip() should we wait for the blank before the script continues
gamma : 1.0,
Monitor gamma for linearisation (will use Bits++ if possible). Overrides monitor settings
bitsMode : None, 'fast', ('slow' mode is deprecated).
Defines how (and if) the Bits++ box will be used. 'fast' updates every frame by drawing a hidden line on the top of the screen.
:note: Preferences. Some parameters (e.g. units) can now be given default values in the user/site preferences and these will be used if None is given here. If you do specify a value here it will take precedence over preferences.
|
To provide accurate measures of frame intervals, to determine whether frames are being dropped. Set this to False while the screen is not being updated e.g. during event.waitkeys() and set to True during critical parts of the script
|
Save recorded screen frame intervals to disk, as comma-separated values.
Parameters: |
A default resize event handler. This default handler updates the GL viewport to cover the entire window and sets the ``GL_PROJECTION`` matrix to be orthagonal in window space. The bottom-left corner is (0, 0) and the top-right corner is the width and height of the :class:`~psychopy.visual.Window` in pixels. Override this event handler with your own to create another projection, for example in perspective. |
Flip the front and back buffers after drawing everything for your frame. (This replaces the win.update() method, better reflecting what is happening underneath). win.flip(clearBuffer=True)#results in a clear screen after flipping win.flip(clearBuffer=False)#the screen is not cleared (so represent the previous screen) |
|
Capture the current Window as an image. This can be done at any time (usually after a .update() command). Frames are stored in memory until a .saveMovieFrames(filename) command is issued. You can issue getMovieFrame() as often as you like and then save them all in one go when finished. |
Writes any captured frames to disk. Will write any format that is understood by PIL (tif, jpg, bmp, png...)
parameters:
mpgCodec: the code to be used by pymedia if the filename ends in .mpg fps: the frame rate to be used throughout the movie only for quicktime (.mov) movies |
Toggles fullscreen mode (GLUT only). Fullscreen mode for PyGame contexts must be set during initialisation of the :class:`~psychopy.visual.Window` |
Set the color of the window.
NB This command sets the color that the blank screen will have on the next
clear operation. As a result it effectively takes TWO `flip()` operations to become
visible (the first uses the color to create the new screen the second presents
that screen to the viewer).
See :ref:`colorspaces` for further information about the ways to specify colors and their various implications.
:Parameters:
color :
Can be specified in one of many ways. If a string is given then it
is interpreted as the name of the color. Any of the standard html/X11
`color names <http://www.w3schools.com/html/html_colornames.asp>`
can be used. e.g.::
myStim.setColor('white')
myStim.setColor('RoyalBlue')#(the case is actually ignored)
A hex value can be provided, also formatted as with web colors. This can be
provided as a string that begins with # (not using python's usual 0x000000 format)::
myStim.setColor('#DDA0DD')#DDA0DD is hexadecimal for plum
You can also provide a triplet of values, which refer to the coordinates
in one of the :ref:`colorspaces`. If no color space is specified then the color
space most recently used for this stimulus is used again.
myStim.setColor([1.0,-1.0,-1.0], 'rgb')#a red color in rgb space
myStim.setColor([0.0,45.0,1.0], 'dkl') #DKL space with elev=0, azimuth=45
myStim.setColor([0,0,255], 'rgb255') #a blue stimulus using rgb255 space
Lastly, a single number can be provided, x, which is equivalent to providing
[x,x,x].
myStim.setColor(255, 'rgb255') #all guns o max
colorSpace : string or None
defining which of the :ref:`colorspaces` to use. For strings and hex
values this is not needed. If None the default colorSpace for the stimulus is
used (defined during initialisation).
operation : one of '+','-','*','/', or '' for no operation (simply replace value)
for colors specified as a triplet of values (or single intensity value)
the new value will perform this operation on the previous color
thisStim.setColor([1,1,1],'rgb255','+')#increment all guns by 1 value
thisStim.setColor(-1, 'rgb', '*') #multiply the color by -1 (which in this space inverts the contrast)
thisStim.setColor([10,0,0], 'dkl', '+')#raise the elevation from the isoluminant plane by 10 deg
|
This method is called from within the draw routine and sets the scale of the OpenGL context to map between units. Could potentially be called by the user in order to draw OpenGl objects manually in each frame. The |
Sets the visibility of the mouse cursor. If Window was initilised with noGUI=True then the mouse is initially set to invisible, otherwise it will initially be visible.
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed Nov 3 14:03:45 2010 | http://epydoc.sourceforge.net |