Forked from SteveGilham/gist:335e15f5aa4bbf579184
Last active
September 5, 2017 13:54
-
-
Save MomenFathi/fdd000704e40969895d75db2423aea0c to your computer and use it in GitHub Desktop.
WPF for Python Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from wpf import * | |
| # Create window | |
| my_window = Window() | |
| my_window.Title = 'Welcome to IronPython' | |
| # Create StackPanel to Layout UI elements | |
| my_stack = StackPanel() | |
| my_stack.Margin = Thickness(15) | |
| my_window.Content = my_stack | |
| # Create Button and add a Button Click event handler | |
| my_button = Button() | |
| my_button.Content = 'Push Me' | |
| my_button.FontSize = 24 | |
| my_button.BitmapEffect = DropShadowBitmapEffect() | |
| def clicker(sender, args): | |
| # Create new label | |
| my_message = Label() | |
| my_message.FontSize = 48 | |
| my_message.Content = 'Welcome to IronPython!' | |
| # Add label into stack panel of controls | |
| my_stack.Children.Add (my_message) | |
| my_button.Click += clicker | |
| my_stack.Children.Add (my_button) | |
| # Run application | |
| my_app = Application() | |
| my_app.Run (my_window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment