Up | Example 01 - StructuredPropertyBag | Example 02 - WinForms Controls | Example 3 - Custom User Interface | Example 04 - TCP Socket Communication | Example 05 - Simple Text Print | Example 06 - Modeless .Net Dialog | Example 07 - StopWatch | Example 08 - Product Selection Page | Example 09 - PyScripter - Eclipse Test Program | Example 10 - Access Control with custom .Net Plugin

 

  

 
Example 09 - PyScripter - Eclipse Test Program
This is a small test program to demonstrate Python for .Net compliance.

Provided to test PyScripter or Eclipse development environment.

Hint: Copy the CLR.dll/Python.RunTime.dll to the PyScripter.exe directory to things running and in the directory where the HelloApp.py resides.

HelloApp.py

# ===========================================================================
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# ===========================================================================

import CLR
import CLR.System.Windows.Forms as WinForms
from CLR.System.Drawing import Size, Point


class HelloApp(WinForms.Form):
    """A simple hello world app that demonstrates the essentials of
       winforms programming and event-based programming in Python."""

    def __init__(self):
        self.Text = "Hello World From Python"
        self.AutoScaleBaseSize = Size(5, 13)
        self.ClientSize = Size(392, 117);
        h = WinForms.SystemInformation.CaptionHeight
        self.MinimumSize = Size(392, (117 + h))

        # Create the button
        self.button = WinForms.Button()
        self.button.Location = Point(256, 64)
        self.button.Size = Size(120, 40)
        self.button.TabIndex = 2
        self.button.Text = "Click Me!"

        # Register the event handler
        self.button.Click += self.button_Click

        # Create the text box
        self.textbox = WinForms.TextBox()
        self.textbox.Text = "Hello World"
        self.textbox.TabIndex = 1
        self.textbox.Size = Size(360, 20)
        self.textbox.Location = Point(16, 24)

        # Add the controls to the form
        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("Please do not press this button again.")

    def run(self):
        print "In Run method"
        WinForms.Application.Run(self)


def main():
    HelloApp().run()


if __name__ == '__main__':
    main()
 
 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.