import wpf import thread from System.Windows import Application, Window class MyWindow(Window): def __init__(self): wpf.LoadComponent(self, 'WpfApplication2.xaml') def setText(self): self.textblock.Text = "Hiiii!" def button_Click(self, sender, e): thread.start_new_thread(self.setText,()) if __name__ == '__main__': Application().Run(MyWindow())
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WpfApplication2" Height="300" Width="300"> <Grid> <TextBlock x:Name="textblock" Text="Oi" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" FontSize="32" TextAlignment="Center" /> <Button x:Name="button" Content="Change" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="100" Height="50" Click="button_Click"/> </Grid> </Window>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)