[visionegg] Re: [visionegg]

  • From: Bart Geurten <bart.geurten@xxxxxxxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Thu, 11 Jan 2007 20:35:32 +0100

Hi Mason,

I hope the below attached code can help. This script now changes the text attribute. Another option is to create two stimuli and then change there on attribute.

Here's the code:

#####################################################################################################################
#!/usr/bin/env python
"""Text Script"""


############################
#  Import various modules  #
############################

import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()

from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation
from VisionEgg.MoreStimuli import *
from VisionEgg.Gratings import *
from Numeric import *
from VisionEgg.Text import *

#####################################
#  Initialize OpenGL window/screen  #
#####################################

screen = get_default_screen()



######################################
#  Create sinusoidal grating object  #
######################################


stimulus = Text(position = (screen.size[0]/2,screen.size[1]/2),
             anchor='center',
             color = (1.0,0.0,0.0,1.0),
             font_size=30,
             font_name = 'c:\\WINDOWS\\Fonts\\GFYOTEP.TTF')


########################
# Controller Functions #
########################


def text_func(t):

    if t >0 and t<= 1.5:
        text = 'Hello'
    else:
        text = 'Hello again'
    return text

def on_func(t):
    if t > 3.0:
        return 0
    else:
        return 1


###############################################################
#  Create viewport - intermediary between stimuli and screen  #
###############################################################

viewport = Viewport( screen=screen, stimuli=[stimulus] )

on_controller = FunctionController(during_go_func=on_func)
text_controller = FunctionController(during_go_func=text_func)

########################################
#  Create presentation object and go!  #
########################################



p = Presentation(go_duration=(4.0,'seconds'),viewports=[viewport])


p.add_controller(stimulus,'text',text_controller)
p.add_controller(stimulus,'on',on_controller)

p.go()



################################################################################################################

greetz

BART

--
Bart Geurten
Diplom Biologe
Lehrstuhl fuer Neurobiologie
Fakultaet fuer Biologie
Universitaet Bielefeld
Postbox 10 01 31
33501 Bielefeld
Germany

tel: + 49 (0)521 106 - 5737
fax: + 49 (0)521 106 - 89034
Email: bart.geurten@xxxxxxxxxxxxxxxx
http://www.uni-bielefeld.de/biologie/Neurobiologie/index.html
-------------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: