APPENDIX: CODE LISTING

 

 

 

 

 

Make some noise (1)

import numpy

from matplotlib import pyplot

noise = numpy.random.rand(500, 500, 3)

pyplot.imshow(noise)

pyplot.show()

Chapter 3: Display

Pygaze

constants.py

# Display settings (type and resolution).

DISPTYPE = ‘pygame’

DISPSIZE = (1920, 1080)

# Default foreground and background colour.

FGC = (0, 0, 0)

BGC = (128, 128, 128)

experiment.py

from pygaze.display import Display

import pygaze.libtime as timer

# Initialise a new Display instance.

disp = Display()

# Update the display (this makes the grey background visible).

disp.show()

# Pause for two seconds.

timer.pause(2000)

# Close the Display again.

disp.close()

Pyschopy

constants.py

# Window resolution.

DISPSIZE = (1920, 1080)

# Default ...

Get Python for Experimental Psychologists now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.