コード例 #1
0
    def __init__(self):
        rd = ResourceDictionary()
        rd.Source = Uri(
            "pack://application:,,,/ClassicAssist.Shared;component/Resources/DarkTheme.xaml"
        )
        self.Resources.MergedDictionaries.Add(rd)
        self.Background = self.Resources["ThemeWindowBackgroundBrush"]

        self.Content = XamlReader.Parse(xaml)
        self.Title = "Rudder"
        self.Topmost = True
        self.Height = 250
        self.Width = 250
        self.refreshTime = TimeSpan.FromSeconds(30)

        self.events = [('forwardLeft', 'Forward Left'), ('forward', 'Forward'),
                       ('forwardRight', 'Forward Right'), ('left', 'Left'),
                       ('turnAround', 'Turn Around'), ('right', 'Right'),
                       ('backLeft', 'Back Left'), ('back', 'Back'),
                       ('backRight', 'Back Right'), ('stop', 'Stop'),
                       ('raiseAnchor', 'Raise Anchor'),
                       ('dropAnchor', 'Drop Anchor'),
                       ('turnLeft', 'Turn Left'), ('turnRight', 'Turn Right'),
                       ('start', 'Start')]
        self.setEvents()
コード例 #2
0
ファイル: hello_xaml.py プロジェクト: slobber/pythonnet-test
 def __init__(self):
     xaml = '''<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
             <Grid>
                 <Label Content="Hello XAML!" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             </Grid>
         </Window>'''
     window = XamlReader.Parse(xaml)
     Application().Run(window)
コード例 #3
0
ファイル: SampleScript02.py プロジェクト: xela30/Samples
def getNumberOfSpeakers():
  vm = ViewModel(Application.Current.MainWindow.DataContext.Speakers.Length)
  stream = Application.Current.GetType().Assembly.GetManifestResourceStream(
    "IronPython.UI.Scripts.ResultWindow.xaml")
  reader = StreamReader(stream)
  window = XamlReader.Parse(reader.ReadToEnd())
  reader.Close()
  stream.Close()
  window.DataContext = vm
  window.FindName("CloseButton").Click += lambda s, e: window.Close()
  window.Show()
コード例 #4
0
ファイル: helper.py プロジェクト: slobber/pythonnet-test
    def _load(self, xaml=None):
        '''创建一个 Xaml 窗口程序

        :param xaml: xaml 文件路径或者 xaml 格式的 xml 字符串
        '''
        window = None
        if not xaml:
            xaml = PythonWin.emptyWindowXaml

        if xaml.startswith('<Window xmlns'):
            window = XamlReader.Parse(xaml)
        else:
            stream = StreamReader(xaml)
            window = XamlReader.Load(stream.BaseStream)
        self.window = window
        self.controls = {'All': {}}
        self._get_windows_controls(window)
        self.auto_bind_events()

        invert_op = getattr(self, "load", None)
        if callable(invert_op):
            getattr(self, 'load')()
コード例 #5
0
	def __init__(self):
		rd = ResourceDictionary()
		rd.Source = Uri("pack://application:,,,/ClassicAssist.Shared;component/Resources/DarkTheme.xaml")
		self.Resources.MergedDictionaries.Add(rd)
		self.Background = self.Resources["ThemeWindowBackgroundBrush"]		
		
		self.Content = XamlReader.Parse(xaml)
		self.Title = "Durability"
		self.Topmost = True
		self.SizeToContent = SizeToContent.Width
		self.Height = 400
		self.refreshTime = TimeSpan.FromSeconds(30)
		
		self.listView = self.Content.FindName('listView')
		self.startButton = self.Content.FindName('startButton')
		self.startButton.Click += self.onClick
		
		self.timer = DispatcherTimer()
		self.timer.Tick += self.onTick
		self.timer.Interval = TimeSpan().FromSeconds(0)
		self.timer.Start()
		self.timer.Interval = self.refreshTime
		self.Running = True
コード例 #6
0
 def __init__(self):
     self._vm = ViewModel()
     self.root = XamlReader.Parse(XAML_str)
     self.DataPanel.DataContext = self._vm
     self.Button.Click += self.OnClick