Odd. I'm using the binaries from dynamicsilverlight. The following code works fine as a standalone example, but doesn't change the font size when run from inside my web ide ??? Odd.
from System import TimeSpan from System.Windows import Application, Duration from System.Windows.Controls import Canvas, TextBlock from System.Windows.Media.Animation import ( DoubleAnimation, Storyboard ) root = Canvas() Application.Current.RootVisual = root t = TextBlock() t.FontSize = 20 t.Text = 'Move the Mouse Over Me' root.Children.Add(t) sb = Storyboard() duration = Duration(TimeSpan.FromSeconds(0.25)) a = DoubleAnimation() a.Duration = duration sb.Duration = duration sb.AutoReverse = True sb.Children.Add(a) Storyboard.SetTarget(a, t) Storyboard.SetTargetProperty(a, 'FontSize') a.From = 20 a.To = 30 def anim(s, e): print 'Starting' sb.Begin() t.MouseEnter += anim root.Resources.Add(sb) Michael Foord wrote: > Any idea why the following code does nothing? (root is the application > root visual - the textblock becomes visible and 'starting' is printed at > the right time - but the fint size doesn't change as I would expect from > the Silverlight docs.) > > from System import TimeSpan > from System.Windows import Duration > from System.Windows.Controls import TextBlock > from System.Windows.Media.Animation import ( > DoubleAnimation, Storyboard > ) > > root.Children.Clear() > root.Resources.Clear() > > t = TextBlock() > t.FontSize = 20 > t.Text = 'Something Blue' > root.Children.Add(t) > > sb = Storyboard() > duration = Duration(TimeSpan.FromSeconds(2)) > a = DoubleAnimation() > a.Duration = duration > sb.Duration = duration > sb.Children.Add(a) > > Storyboard.SetTarget(a, t) > Storyboard.SetTargetProperty(a, 'FontSize') > a.From = 20 > a.To = 40 > > def anim(s, e): > print 'Starting' > sb.Begin() > > t.MouseEnter += anim > > root.Resources.Add(sb) > > > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com