def get_console_block():
    block = TextBlock()
    block.FontSize = 15
    block.Margin = Thickness(0, 0, 0, 0)
    block.TextWrapping = TextWrapping.Wrap
    block.FontFamily = FontFamily("Consolas, Global Monospace")
    return block
Beispiel #2
0
def get_console_block():
    block = TextBlock()
    block.FontSize = 15
    block.Margin = Thickness(0, 0, 0, 0)
    block.TextWrapping = TextWrapping.Wrap
    block.FontFamily = FontFamily("Consolas, Global Monospace")
    return block
Beispiel #3
0
def _get_text_block(text):
    block = TextBlock()
    block.FontSize = 15
    block.FontFamily = FontFamily(
        "Verdana,Tahoma,Geneva,Lucida Grande,Trebuchet MS,Helvetica,Arial,Serif"
    )
    block.Text = text
    return block
Beispiel #4
0
 def _method(self):
     root.Children.Clear()
     main = StackPanel()
     
     t = TextBlock(Text=" Examples ")
     t.FontSize = 32
     t.Foreground = SolidColorBrush(Colors.Magenta)
     main.Children.Add(t)
 
     b = Button('Browser DOM')
     b.Click += lambda: SetExample('browserDOM')
     main.Children.Add(b)
     
     b = Button('HTML Events')
     b.Click += lambda: SetExample('inputEvents')
     main.Children.Add(b)
 
     b = Button('Video Player')
     b.Click += lambda: SetExample('videoExample')
     main.Children.Add(b)
 
     b = Button('Open File Dialog')
     b.Click += lambda: SetExample('openFileDialog')
     main.Children.Add(b)
 
     b = Button('Local Storage')
     b.Click += lambda: SetExample('isolatedStorageFile')
     main.Children.Add(b)
 
     b = Button('Loading XAML')
     b.Click += lambda: SetExample('loadingXaml')
     main.Children.Add(b)
 
     b = Button('Using Controls')
     b.Click += lambda: SetExample('controls')
     main.Children.Add(b)
 
     b = Button('WebClient')
     b.Click += lambda: SetExample('webClient')
     main.Children.Add(b)
 
     b = Button('Threading')
     b.Click += lambda: SetExample('threading')
     main.Children.Add(b)
 
     b = Button('Read from a File')
     b.Click += lambda: SetExample('openFile')
     main.Children.Add(b)
 
     b = Button('Setting Position')
     b.Click += lambda: SetExample('position')
     main.Children.Add(b)
 
     b = Button('Animation')
     b.Click += lambda: SetExample('animation')
     main.Children.Add(b)
             
     root.Children.Add(main)
Beispiel #5
0
 def create_headline(self):
     headline = TextBlock()
     headline.Margin = Thickness(5, 5, 5, 5)
     headline.FontSize = 16
     headline.Text = 'Twitter on Silverlight for IronPython in Action'
     headline.Foreground = SolidColorBrush(Colors.White)
     self.Children.Add(headline)
     
     self.headline = headline
Beispiel #6
0
 def get_text(self, text):
     tb = TextBlock()
     tb.Text = text
     tb.Width = self.canvas.ActualWidth
     tb.Height = 40
     tb.FontSize = 30
     tb.Background = SolidColorBrush(Colors.Black)
     tb.Foreground = SolidColorBrush(Colors.White)
     tb.TextAlignment = TextAlignment.Center
     return tb
Beispiel #7
0
from System.Windows import Application
from System.Windows.Controls import Canvas, TextBlock

canvas = Canvas()
textblock = TextBlock()
textblock.FontSize = 24
textblock.Text = 'Hello World from IronPython'
canvas.Children.Add(textblock)

Application.Current.RootVisual = canvas
Beispiel #8
0
from System.Windows import Application
from System.Windows.Controls import Canvas, TextBlock
from System.Threading import Thread, ThreadStart

root = Canvas()
Application.Current.RootVisual = root

text = TextBlock()
thread_id = Thread.CurrentThread.ManagedThreadId
text.Text = "Created on thread %s" % thread_id
text.FontSize = 24
root.Children.Add(text)

def wait():
    Thread.Sleep(3000)
    thread_id = Thread.CurrentThread.ManagedThreadId
    def SetText():
        text.Text = 'Hello from thread %s' % thread_id
    text.Dispatcher.BeginInvoke(SetText)
    
t = Thread(ThreadStart(wait))
t.Start()
Beispiel #9
0
from System.Windows import Application
from System.Windows.Controls import Canvas, TextBlock, MediaElement
from System.Windows.Media import VideoBrush, Stretch

root = Canvas()
video = MediaElement() 
source = Uri('../SomeVideo.wmv', UriKind.Relative)
video.Source = source
video.Opacity = 0.0
video.IsMuted = True

def restart(s, e):
    video.Position = TimeSpan(0)
    video.Play()

video.MediaEnded += restart

brush = VideoBrush()
brush.Stretch = Stretch.UniformToFill
brush.SetSource(video)

t = TextBlock()
t.Text = 'Video'
t.FontSize = 120
t.Foreground = brush

root.Children.Add(t)
root.Children.Add(video)

Application.Current.RootVisual = root
Beispiel #10
0
from System import TimeSpan
from System.Windows import Application, Duration, PropertyPath
from System.Windows.Controls import Canvas, TextBlock
from System.Windows.Media.Animation import (
    DoubleAnimation, Storyboard
)

root = Canvas()

Application.Current.RootVisual = root

root.Children.Clear()
root.Resources.Clear()

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, PropertyPath('FontSize'))
a.From = 20
a.To = 30
Beispiel #11
0
def _get_text_block(text):
    block = TextBlock()
    block.FontSize = 15
    block.FontFamily = FontFamily("Verdana,Tahoma,Geneva,Lucida Grande,Trebuchet MS,Helvetica,Arial,Serif")
    block.Text = text
    return block