[IronPython] Running on Mono

Keith J. Farmer kfarmer at thuban.org
Sat Apr 9 08:10:04 CEST 2005


(Of course everyone realizes I'm just trying to avoid installing 2.0 on
my newly-installed system.. At least until Beta2's release.)
 
The following fails under Mono with a missing CreateDelegate method.  So
close, yet so far...
 
import sys
 
sys.LoadAssemblyByName("System.Windows.Forms")
 
from System.Windows.Forms import *
 
def handler(sender, eventArgs):
    button.Text = "Clicked"
 
f = Form(Text="Test Button Form")
f.StartPosition = FormStartPosition.CenterScreen
f.FormBorderStyle = FormBorderStyle.FixedDialog
 
button = Button(Text="Test")
button.Click += handler    # comment this line out, and you'll have a
form with a useless button
 
f.Controls.Add(button)
 
f.ShowDialog()
 
.....
 
C:\Program Files\IronPython-0.7.1\Examples>fepy testButtonForm.py
#region #line XplatUI Constructor called
 
** (C:\Program Files\IronPython-0.7.1\bin\IronPythonConsole.exe):
WARNING **: Missing method CreateDelegate in assembly C:\Program
Files\IronPython-0.7.1\bin\IronPython.dll, type DynamicMethod
System.NullReferenceException: Object reference not set to an instance
of an object
in (unmanaged) 004111C2
in <0x003e3> IronPython.Objects.Ops:GetDelegate (object,System.Type)
in <0x00024> IronPython.Objects.ReflectedEvent:__iadd__ (object)
in <0x00278> IronPython.Objects.Ops:InPlaceAdd (object,object)
in <0x00251> __main__:init ()
in <0x0007d> IronPython.Hosting.PythonEngine:RunFileInNewModule
(string,string)
in <0x00012> IronPython.Hosting.PythonEngine:RunFileInNewModule (string)
in <0x00047> IronPythonConsole.PythonCommandLine:RunFile
(IronPython.Hosting.PythonEngine,string)
 
----------
Keith J. Farmer
kfarmer at thuban.org
http://www.thuban.org
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20050408/7618d93f/attachment.html>


More information about the Ironpython-users mailing list