Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from psychopy import core,event,visual
- def rescale(self, width=0, height=0, operation='', units=None, log=True):
- (old_width,old_height) = self.size
- if all([height,width]):
- pass
- elif height:
- ratio = height/old_height
- width = old_width * ratio
- elif width:
- ratio = width/old_width
- height = old_height * ratio
- self.setSize([width,height],operation,units,log)
- visual.ImageStim.rescale = rescale
- win = visual.Window()
- img = visual.ImageStim(win,image='pic2.jpg') # point this to an image you have locally.
- img.draw()
- win.flip()
- core.wait(1)
- img.rescale(width=.7)
- img.draw()
- win.flip()
- core.wait(1)
Advertisement
Add Comment
Please, Sign In to add comment