habe seit kurzem mit dem CLR-Modul zu tun, allerdings nicht ganz ohne Probleme.
z.B. soll beim Klick auf das Objekt "checkBox1" eine Funktion "checkBox1_pressed" ausgeführt werden, wird sie aber nicht.
Bekomme stattdessen eine Exception geworfen.
Ich hoffe mir kann irgendjemand helfen. Eventuell den Quellcode selber mal kompilieren und ausprobieren.
vielen Dank!
Die Exception fängt folgendermaßen an:
Informationen über das Aufrufen von JIT-Debuggen
finden Sie am Ende dieser Meldung, anstatt in diesem Dialogfeld.
************** Ausnametext **************
Python.Runtime.PythonException: Eine Ausnahme vom Typ Python.Runtime.PythonException wurde ausgelöst.
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
etc.
Hier der Quellcode:
Code: Alles auswählen
import CLR
import CLR.System as System
import CLR.System.Windows.Forms as WinForms
class Form1(WinForms.Form):
def __init__(self):
this = self
true = True
false = False
this.groupBox1 = System.Windows.Forms.GroupBox();
this.radioButton1 = System.Windows.Forms.RadioButton();
this.checkBox1 = System.Windows.Forms.CheckBox();
this.textBox1 = System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
#
# groupBox1
#
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Location = System.Drawing.Point(120, 96);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = System.Drawing.Size(344, 168);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
#
# radioButton1
#
this.radioButton1.Location = System.Drawing.Point(56, 56);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = System.Drawing.Size(128, 16);
this.radioButton1.TabIndex = 0;
this.radioButton1.Text = "radioButton1";
#
# checkBox1
#
this.checkBox1.Location = System.Drawing.Point(48, 104);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = System.Drawing.Size(120, 16);
this.checkBox1.TabIndex = 1;
this.checkBox1.Text = "checkBox1";
this.checkBox1.Click += System.EventHandler(this.checkBox1_pressed);
#
# textBox1
#
this.textBox1.Location = System.Drawing.Point(128, 16);
this.textBox1.Name = "textBox1";
this.textBox1.Size = System.Drawing.Size(160, 20);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "231324";
#this.textBox1.TextChanged += System.EventHandler(this.textBox1_TextChanged);
#
# Form1
#
this.AutoScaleBaseSize = System.Drawing.Size(5, 13);
this.ClientSize = System.Drawing.Size(568, 365);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "Form1";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
WinForms.Application.Exit()
def checkBox1_pressed():
print "sdf-------------"
if __name__ == "__main__":
theForm = Form1()
WinForms.Application.Run(theForm)
# end of file