[visionegg] Re: FRAMES_ABSOLUTE

  • From: Andrew Straw <astraw@xxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Mon, 05 Oct 2009 13:11:52 -0700

rosner@xxxxxxxxxxxxxxxxxxxx wrote:
> Hello everybody,
>
> during my thesis I had a lot of trouble with a commercial stimulus
> device. This is why I now will give the VisionEgg a chance. I am not
> an exceptionally gifted programmer, so possibly I will have some droll
> questions over the next weeks.
>
> So lets start: There is a demo called 'framecount.py'. Why has
> 'FRAMES_ABSOLUTE' to be imported? It is not a module or class or
> something like this, but rather an attribute.
Hi Ronny, the code in question does:

from VisionEgg.FlowControl import Presentation, \
    FunctionController, FRAMES_ABSOLUTE
t_controller = FunctionController(during_go_func=text_func,
                                  temporal_variables = FRAMES_ABSOLUTE)

This could just as easily be:

import VisionEgg.FlowControl

t_controller = VisionEgg.FlowControl.FunctionController(
    during_go_func=text_func,
    temporal_variables = VisionEgg.FlowControl.FRAMES_ABSOLUTE)

Both are equivalent and standard Python. You can import any identifier
with "from x import identifier". (I don't know what gave you the
impression that only module identifiers could be imported this way.) One
of the nice things about Python IMO is that there's aren't many special
cases. For example, a module identifier behaves just like any other.

-Andrew

-- 
Andrew D. Straw, Ph.D.
California Institute of Technology
http://www.its.caltech.edu/~astraw/

======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: