User Tools

Site Tools


simple_input_example

Differences

This shows you the differences between two versions of the page.


simple_input_example [2025/02/25 22:20] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +<code>
 +import clr
 +clr.AddReference ('System.Windows.Forms')
 +clr.AddReference('System.Drawing')
 +
 +from System.Drawing import Point
 +from System.Windows.Forms import TextBox, Keys, KeyPressEventHandler
 +
 +from System.Windows import Forms
 +
 +class MyMainForm(Forms.Form):
 +    def __init__(self):
 +        self.Width = 300
 +        self.Height = 200
 +        self.Text = 'Main Form'
 +        my_button = Forms.Button(Text='Go!')
 +        my_button.Click += self.MyOnClick
 +        my_button.Location = Point(25, 95)
 +        self.Controls.Add(my_button)
 +        
 +        self.textbox = TextBox()
 +        self.textbox.Text = "0"
 +        self.textbox.Location = Point(25, 75)
 +        self.textbox.Width = 150
 +        #self.textbox.KeyDown += self.OnEnter
 +        self.textbox.KeyPress += KeyPressEventHandler(self.OnEnter)
 +        self.Controls.Add(self.textbox)
 +        
 +    def MyOnClick(self, *args):
 +        self.Finished()
 +    
 +    def OnEnter(self, e, args):
 +        key = args.KeyChar
 +        if key == Keys.Enter:
 +            self.Finished()
 +            
 +    def Finished(self):
 +        Misc.SendMessage("Answer was: {}".format(self.textbox.Text))
 +        self.Close()
 +
 +app = MyMainForm()
 +Forms.Application.Run(app)
 +</code>
  
simple_input_example.txt · Last modified: 2025/02/25 22:20 by 127.0.0.1

Exception: Git command failed to perform periodic pull: Warning: Permanently added 'github.com,140.82.114.4' (ECDSA) to the list of known hosts. From github.com:RazorEnhanced/razorenhanced.github.io * branch main -> FETCH_HEAD error: Your local changes to the following files would be overwritten by merge: doc/api/CUO.html doc/api/Gumps.html doc/api/Item.html doc/api/Items.html doc/api/Journal.html doc/api/Misc.html doc/api/Mobile.html doc/api/PacketLogger.html doc/api/PathFinding.html doc/api/Player.html doc/api/Spells.html doc/api/Target.html doc/api/Trade.html doc/api/Vendor.html Please commit your changes or stash them before you merge. Aborting

Exception: Git command failed to perform periodic pull: Warning: Permanently added 'github.com,140.82.114.4' (ECDSA) to the list of known hosts. From github.com:RazorEnhanced/razorenhanced.github.io * branch main -> FETCH_HEAD error: Your local changes to the following files would be overwritten by merge: doc/api/CUO.html doc/api/Gumps.html doc/api/Item.html doc/api/Items.html doc/api/Journal.html doc/api/Misc.html doc/api/Mobile.html doc/api/PacketLogger.html doc/api/PathFinding.html doc/api/Player.html doc/api/Spells.html doc/api/Target.html doc/api/Trade.html doc/api/Vendor.html Please commit your changes or stash them before you merge. Aborting

An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the gitbacked plugin.

More info has been written to the DokuWiki error log.