[IronPython] Slider In IronPython

Andrew Evans andrew.canit at gmail.com
Thu Jan 7 01:44:36 CET 2010


Ok I guess my first question is: Is there anyway to debug Silverlight
Applications. When I receive no errors makes it hard to do any debugging any
suggestions?

Next question

Making a slider for a video player here is the essential source. I
appreciate the feedback

##### BEGIN LOTS OF CODE #####

from System.Windows import Application
from System.Windows.Controls import MediaElement
from System.Windows.Controls import Button, Orientation, StackPanel, Slider
from System import Uri, UriKind
from System.Windows.Media.Imaging import BitmapImage
from System.Windows.Threading import *

.......

        self.timer = DispatcherTimer()
        self.timer.Interval = TimeSpan.FromMilliseconds(50)
        self.timer.Tick += MyTimeToTick
        self.main = StackPanel()
.......

        #add a video slider
        self.myslide = Slider()
        self.myslide.Width = 250

........

      self.layer1.Children.Add(self.myslide)

.......

        #create Media Element
        self.video = MediaElement()

.......

        self.video.CurrentStateChanged += videoChanged

........

    def MyTimeToTick(self, s, e):
        if self.video.NaturalDuration.TimeSpan.TotalSeconds > 0:
            self.myslide.Value = self.video.Position.TotalSeconds /
self.video.NaturalDuration.TimeSpan.TotalSeconds


    def videoChanged(self, s, e):
        if self.video.NaturalDuration.CurrentState == self.video.Playing:
            self.timer.Start()
        else:
            self.timer.Stop()

##### END CODE ######
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100106/06180040/attachment.html>


More information about the Ironpython-users mailing list