Eyetracker
 
Loading...
Searching...
No Matches
pygaze._screen.pygamescreen.PyGameScreen Class Reference
Inheritance diagram for pygaze._screen.pygamescreen.PyGameScreen:
pygaze._screen.basescreen.BaseScreen

Public Member Functions

 __init__ (self, dispsize=settings.DISPSIZE, fgc=settings.FGC, bgc=settings.BGC, mousevisible=settings.MOUSEVISIBLE, screen=None, **args)
 
 create (self, screen=None)
 
 clear (self, colour=None)
 
 copy (self, screen)
 
 draw_circle (self, colour=None, pos=None, r=50, pw=1, fill=False)
 
 draw_ellipse (self, colour=None, x=None, y=None, w=50, h=50, pw=1, fill=False)
 
 draw_rect (self, colour=None, x=None, y=None, w=50, h=50, pw=1, fill=False)
 
 draw_line (self, colour=None, spos=None, epos=None, pw=1)
 
 draw_polygon (self, pointlist, colour=None, pw=1, fill=True)
 
 draw_fixation (self, fixtype='cross', colour=None, pos=None, pw=1, diameter=12)
 
 draw_text (self, text='text', colour=None, pos=None, center=True, font='mono', fontsize=12, antialias=True)
 
 draw_image (self, image, pos=None, scale=None)
 
 set_background_colour (self, colour=None)
 
- Public Member Functions inherited from pygaze._screen.basescreen.BaseScreen
 __init__ (self)
 

Public Attributes

 dispsize = dispsize
 
 fgc = fgc
 
 bgc = bgc
 
 mousevis = mousevisible
 
 screen = pygame.Surface(self.dispsize)
 

Detailed Description

A class for PyGame Screen objects, for visual stimuli (to be displayed via a Display object)

Constructor & Destructor Documentation

◆ __init__()

pygaze._screen.pygamescreen.PyGameScreen.__init__ ( self,
dispsize = settings.DISPSIZE,
fgc = settings.FGC,
bgc = settings.BGC,
mousevisible = settings.MOUSEVISIBLE,
screen = None,
** args )
        Constructor.
    
        TODO: docstring

Member Function Documentation

◆ clear()

pygaze._screen.pygamescreen.PyGameScreen.clear ( self,
colour = None )
Clears the screen and fills it with a colour
        
        arguments
        None
        
        keyword arguments
        colour  -- the colour to fill the screen with (a colour name
                   (e.g. 'red') or a RGB(A) tuple (e.g. (255,0,0) or 
                   (255,0,0,255))) or None for the default background
                   colour, self.bgc (default = None)
        
        returns
        Nothing -- clears self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ copy()

pygaze._screen.pygamescreen.PyGameScreen.copy ( self,
screen )
Copies a screen to the current screen
        
        arguments
        screen  -- a libscreen.Screen object
        
        returns
        Nothing -- sets the self.screen property to a copy of
                   screen.screen

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ create()

pygaze._screen.pygamescreen.PyGameScreen.create ( self,
screen = None )
Creates a new Screen object, filled with either the background
        colour or specified screen
        
        arguments
        None
        
        keyword arguments
        screen  -- a libscreen.Screen object, to be displayed on the
                   new screen or None for the background colour
        returns
        Nothing -- sets the self.screen property to a PyGame Surface
                   or a list of PsychoPy stimuli, depening on the
                   disptype

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_circle()

pygaze._screen.pygamescreen.PyGameScreen.draw_circle ( self,
colour = None,
pos = None,
r = 50,
pw = 1,
fill = False )
Draws a circle on the screen
        
        arguments
        None
        
        keyword arguments
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        pos     -- circle center, an (x,y) position tuple or None for a
                   central position (default = None)
        r       -- circle radius (default = 50)
        pw      -- penwidth: circle line thickness (default = 1)
        fill        -- Boolean indicating whether circle should be filled or
                   not (default = False)
        
        returns
        Nothing -- draws a circle on (PyGame) or adds a Circle stimulus
                   to (PsychoPy) the self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_ellipse()

pygaze._screen.pygamescreen.PyGameScreen.draw_ellipse ( self,
colour = None,
x = None,
y = None,
w = 50,
h = 50,
pw = 1,
fill = False )
Draws an ellipse on the screen
        
        arguments
        None
        
        keyword arguments
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        x       -- x coordinate of the rectangle in which the ellipse is
                   drawn or None for a horizontal centrally drawn
                   ellipse (default = None)
        y       -- y coordinate of the rectangle in which the ellipse is
                   drawn or None for a vertical centrally drawn
                   ellipse (default = None)
        w       -- width of the rectangle in which the ellipse is drawn
                   (default = 50)
        h       -- height of the rectangle in which the ellipse is drawn
                   (default = 50)
        pw      -- penwidth: circle line thickness (default = 1)
        fill        -- Boolean indicating whether ellipse should be filled
                   or not (default = False)
        
        returns
        Nothing -- draws an ellipse on (PyGame) or adds a GratinsStim
                   stimulus to (PsychoPy) the self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_fixation()

pygaze._screen.pygamescreen.PyGameScreen.draw_fixation ( self,
fixtype = 'cross',
colour = None,
pos = None,
pw = 1,
diameter = 12 )
Draws a fixation (cross, x or dot) on the screen
        
        arguments
        None
        
        keyword arguments
        fixtype -- type of fixation mark, should be either of the
                   following strings:
                    'cross' -- a '+'
                    'x'     -- a 'x'
                    'dot'       -- a filled circle
                   (default = 'cross')
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        pos     -- fixation center, an (x,y) position tuple or None for
                   a central position (default = None)
        pw      -- penwidth: fixation line thickness (default = 1)
        diameter    -- diameter of the fixation mark in pixels (default =
                   12)
        
        returns
        Nothing -- draws on (PyGame) or adds stimuli to (PsychoPy) the
                   self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_image()

pygaze._screen.pygamescreen.PyGameScreen.draw_image ( self,
image,
pos = None,
scale = None )
Draws an image on the screen
        
        arguments
        image       --  a full path to an image file, or a pygame Surface
                    (if image is neither of these, this function will
                    attempt to treat the image as a PIL Image)
        
        keyword arguments
        pos     --  image center position, an (x,y) position tuple or
                    None for a central position (default = None)
        scale       --  scale factor for the image or None for no scaling
                    (default = None)
        
        returns
        Nothing --  loads and draws an image surface on (PyGame) or
                    adds SimpleImageStim to (PsychoPy) the self.screen
                    property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_line()

pygaze._screen.pygamescreen.PyGameScreen.draw_line ( self,
colour = None,
spos = None,
epos = None,
pw = 1 )
Draws a line on the screen
        
        arguments
        None
        
        keyword arguments
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        spos        -- line start, an (x,y) position tuple or None for a
                   quarter x and a central y position (default = None)
        epos        -- line end, an (x,y) position tuple or None for a
                   three-quarter x and a central y position (default =
                   None)
        pw      -- penwidth: line thickness (default = 1)
        
        returns
        Nothing -- draws a line on (PyGame) or adds a Line stimulus to
                   (PsychoPy) the self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_polygon()

pygaze._screen.pygamescreen.PyGameScreen.draw_polygon ( self,
pointlist,
colour = None,
pw = 1,
fill = True )
Draws a polygon on the screen
        
        arguments
        pointlist   -- a list of (x,y) tuples resembling the cornerpoints
                   of the polygon
        
        keyword arguments
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        pw      -- penwidth: polygon line thickness (default = 1)
        fill        -- Boolean indicating whether polygon should be filled
                   or not (default = False)
        
        returns
        Nothing -- draws a polygon on (PyGame) or adds a ShapeStim
                   stimulus to (PsychoPy) the self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_rect()

pygaze._screen.pygamescreen.PyGameScreen.draw_rect ( self,
colour = None,
x = None,
y = None,
w = 50,
h = 50,
pw = 1,
fill = False )
Draws a rectangle on the screen
        
        arguments
        None
        
        keyword arguments
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        x       -- x coordinate of the rectangle or None for a
                   horizontal centrally drawn rectangle (default = None)
        y       -- y coordinate of the rectangle or None for a
                   vertical centrally drawn rectangle (default = None)
        w       -- width of the rectangle (default = 50)
        h       -- height of the rectangle (default = 50)
        pw      -- penwidth: ellipse line thickness (default = 1)
        fill        -- Boolean indicating whether rectangle should be filled
                   or not (default = False)
        
        returns
        Nothing -- draws a rectangle on (PyGame) or adds a GratinsStim
                   stimulus to (PsychoPy) the self.screen property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ draw_text()

pygaze._screen.pygamescreen.PyGameScreen.draw_text ( self,
text = 'text',
colour = None,
pos = None,
center = True,
font = 'mono',
fontsize = 12,
antialias = True )
Draws a text on the screen
        
        arguments
        None
        
        keyword arguments
        text        -- string to be displayed (newlines are allowed and will
                   be recognized) (default = 'text')
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        pos     -- text position, an (x,y) position tuple or None for a
                   central position (default = None)
        center  -- Boolean indicating is the pos keyword argument should
                   indicate the text center (True) or the top right
                   coordinate (False) (default = True)
        font        -- font name (a string value); should be the name of a
                   font included in the PyGaze resources/fonts directory
                   (default = 'mono')
        fontsize    -- fontsize in pixels (an integer value) (default = 12)
        antialias   -- Boolean indicating whether text should be antialiased
                   or not (default = True)
        
        returns
        Nothing -- renders and draws a surface with text on (PyGame) or
                   adds a TextStim to (PsychoPy) the self.screen
                   property

Reimplemented from pygaze._screen.basescreen.BaseScreen.

◆ set_background_colour()

pygaze._screen.pygamescreen.PyGameScreen.set_background_colour ( self,
colour = None )
Set the background colour to colour
        
        arguments
        None
        
        keyword arguments
        colour  -- colour for the circle (a colour name (e.g. 'red') or
                   a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) or
                   None for the default foreground colour, self.fgc
                   (default = None)
        
        returns
        Nothing -- sets bgc property to specified colour

Reimplemented from pygaze._screen.basescreen.BaseScreen.

Member Data Documentation

◆ bgc

pygaze._screen.pygamescreen.PyGameScreen.bgc = bgc

◆ dispsize

pygaze._screen.pygamescreen.PyGameScreen.dispsize = dispsize

◆ fgc

pygaze._screen.pygamescreen.PyGameScreen.fgc = fgc

◆ mousevis

pygaze._screen.pygamescreen.PyGameScreen.mousevis = mousevisible

◆ screen

pygaze._screen.pygamescreen.PyGameScreen.screen = pygame.Surface(self.dispsize)

The documentation for this class was generated from the following file: