Created
November 6, 2013 11:34
-
-
Save pewerner/7334679 to your computer and use it in GitHub Desktop.
Simple IronPython WInForm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clr | |
clr.AddReference('System.Windows.Forms') | |
clr.AddReference('System.Drawing') | |
from System.Windows.Forms import * | |
from System.Drawing import * | |
class MyForm(Form): | |
def __init__(self): | |
selectInput = Button() | |
selectInput.Location = Point(350, 50) | |
selectInput.Size = Size(100, 23); | |
selectInput.UseVisualStyleBackColor = True | |
selectInput.Click += self.onClick | |
selectInput.Text = 'Select Input File' | |
global inputFile | |
inputFile = TextBox() | |
inputFile.Location = Point(50, 50) | |
inputFile.Size = Size(183, 20); | |
self.ClientSize = Size(477, 450) | |
self.Controls.Add(selectInput) | |
self.Controls.Add(inputFile) | |
def onClick(self, sender, args): | |
fileDialog = OpenFileDialog() | |
fileDialog.InitialDirectory = "C:\\Users" | |
fileDialog.ShowDialog() | |
inputFile.Text = fileDialog.FileName | |
form = MyForm() | |
Application.Run(form) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment