Permalink
Browse files

form.py example

  • Loading branch information...
1 parent a04c0b5 commit 07a13daf731bfbef57d4f055fa132de9d47fbad6 @ajlopez committed Nov 16, 2012
Showing with 22 additions and 0 deletions.
  1. +3 −0 Src/PythonSharp.Console/PythonSharp.Console.csproj
  2. +19 −0 Src/PythonSharp.Console/examples/form.py
@@ -65,6 +65,9 @@
</None>
</ItemGroup>
<ItemGroup>
+ <Content Include="examples\form.py">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="examples\httpserver.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -0,0 +1,19 @@
+
+from System.Windows.Forms import Form, Button, Application
+from PythonSharp.Utilities import ObjectUtilities
+
+f = Form()
+f.Text = "PythonSharp Form"
+b = Button()
+b.Text = "Hello"
+b.Width = 150
+b.Height = 50
+f.Controls.Add(b)
+
+def click(sender, event):
+ print("Click")
+
+ObjectUtilities.AddHandler(b, "Click", click, locals())
+
+Application.Run(f)
+

0 comments on commit 07a13da

Please sign in to comment.