I like Python.

xiaoxiao2021-03-06  189

# Copyright (c) 2001, 2002 Zope Corporation and Contributors. ## All Rights Reserved. ## 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.system.windows.forms as winformsfrom 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")

Def Run (Self): WinForms.Application.run (Self)

Def main (): helloApp (). Run ()

IF __NAME__ == '__main__': main ()

转载请注明原文地址:https://www.9cbs.com/read-128607.html

New Post(0)