Just to add my 2c with this, the variable scope for behaviours seems
to have changed in Ubuntu Gutsy from Feisty. I'm not sure if you saw
my email the other day saying I was having problems with timelines
executing in Gutsy (Thinking it was an Intel problem, boy was THAT a
dumb theory), but it was this issue.

Not sure what has changed, but in Ubuntu Feisty it appears that
behaviours do not need to be global variables to function. I even
reinstalled Feisty on my machine just to prove the point and it
definitely seems to be the case.

-Josh

On 11/8/07, Johan Mårtenson <[EMAIL PROTECTED]> wrote:
> Hi again,
>
> On 11/7/07, Emmanuele Bassi <[EMAIL PROTECTED]> wrote:
> > hi;
> >
> > On Wed, 2007-11-07 at 21:19 +0100, Johan Mårtenson wrote:
> >
> > > def key_event(stage, event):
> > >     timeline = clutter.Timeline(100, 26)
> > >     alpha = clutter.Alpha(timeline, clutter.sine_func )
> > >
> > >     path_forward = clutter.BehaviourPath(alpha, ((0, 0), (100, 100)))
> > >
> > >     # Up
> > >     if event.keyval == 65362:
> > >         menu = stage.get_nth_child(0)
> > >         path_forward.apply(menu)
> > >
> > >         timeline.start ()
> >
> > the timeline, alpha and path_forward objects go out of scope when
> > control reaches the end of the key_event signal handler; hence, you see
> > no behaviour running because python will simply garbage collect those
> > objects.
>
> I  forgot about that, thanks.
>
> > you should either declare path_forward as a global variable or, going
> > down the object oriented path, as an instance member of your application
> > class.
>
> And indeed you're right. Just making the variables global fixes it.
>
> > ciao,
> > Emmanuele.
--
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to