티스토리 뷰
# Python for .NET
import sys
sys.path.append("..\\Frame1\\bin\\Debug")
import clr
clr.AddReference("Frame1")
import Frame1
import System
import System.Windows.Forms
class pyForm1(Frame1.Form1):
def __init__(self):
self.Text = "Python for .NET"
self.button1.Click += self.button1_Click
def button1_Click(self, sender, e):
self.Button1_Click(sender, e)
def main():
myForm1 = pyForm1()
System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.Run(myForm1)
if __name__ == '__main__':
main()
// C#
using System;
using System.Windows.Forms;
namespace Frame1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Button1_Click(object sender, EventArgs e)
{
this.textBox1.Text = e.ToString();
MessageBox.Show(DateTime.Now.ToString());
}
}
}
Python for .NET Reference
https://github.com/pythonnet/pythonnet
https://github.com/pythonnet/pythonnet/wiki
http://kozyarchuk.blogspot.com/2015/03/winforms-with-python-by-kozyarchuk.html
http://kozyarchuk.blogspot.com/2015/03/testing-winforms-with-python.html
'Ongoing > PythonNET' 카테고리의 다른 글
Python for .NET : Windows.Forms Example 3 (0) | 2019.05.15 |
---|---|
Python for .NET : Windows.Forms Example 1 (0) | 2019.05.08 |