[Zope-CVS] CVS: PythonNet/demo - helloform.py:1.2
Brian Lloyd
brian at zope.com
Fri Aug 8 16:49:53 EDT 2003
Update of /cvs-repository/PythonNet/demo
In directory cvs.zope.org:/tmp/cvs-serv22496/demo
Modified Files:
helloform.py
Log Message:
checkpoint
=== PythonNet/demo/helloform.py 1.1 => 1.2 ===
--- PythonNet/demo/helloform.py:1.1 Mon Feb 17 22:44:35 2003
+++ PythonNet/demo/helloform.py Fri Aug 8 15:49:18 2003
@@ -8,20 +8,19 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-import gc
-gc.disable()
import CLR.System.Windows.Forms as WinForms
from CLR.System.Drawing import Size, Point
-class HelloApp:
+
+class HelloApp(WinForms.Form):
def __init__(self):
- self.form = WinForms.Form()
- self.form.Text = "Hello World From Python"
- self.form.AutoScaleBaseSize = Size(5, 13)
- self.form.ClientSize = Size(392, 117);
+ print 'ran'
+ self.Text = "Hello World From Python"
+ self.AutoScaleBaseSize = Size(5, 13)
+ self.ClientSize = Size(392, 117);
h = WinForms.SystemInformation.CaptionHeight
- self.form.MinimumSize = Size(392, (117 + h))
+ self.MinimumSize = Size(392, (117 + h))
# Create the button
self.button = WinForms.Button()
@@ -32,7 +31,6 @@
# Register the event handler
self.button.Click += self.button_Click
- self.button.Click += self.button_Click2
# Create the text box
self.textbox = WinForms.TextBox()
@@ -42,22 +40,21 @@
self.textbox.Location = Point(16, 24)
# Add the controls to the form
- self.form.AcceptButton = self.button
- self.form.Controls.Add(self.button);
- self.form.Controls.Add(self.textbox);
-
+ self.AcceptButton = self.button
+ self.Controls.Add(self.button);
+ self.Controls.Add(self.textbox);
def button_Click(self, sender, args):
- """ """
+ """Button click event handler"""
WinForms.MessageBox.Show("button was clicked")
- def button_Click2(self, sender, args):
- """ """
- print 'I saw the event too!'
+ def run(self):
+ WinForms.Application.Run(self)
def main():
- WinForms.Application.Run(HelloApp().form)
+ HelloApp().run()
+
if __name__ == '__main__':
main()
More information about the Zope-CVS
mailing list