[IronPython] Avalon tutorial
Martin Maly
Martin.Maly at microsoft.com
Tue Jan 3 01:24:39 CET 2006
I may not have given clear answer last time. Here is the whole thing:
My winforms.py with the fix for Objects=>Runtime change:
import sys
sys.LoadAssemblyByName("System.Windows.Forms")
sys.LoadAssemblyByName("System.Drawing")
sys.LoadAssemblyByName("IronPython")
from System.Drawing import Size
from System.Windows.Forms import Form, Application
from System.Threading import Thread
# here is the change:
from IronPython.Runtime import CallTarget0
import IronPython
def thread_proc():
global dispatcher
dispatcher = Form(Size = Size(0,0))
dispatcher.Show()
dispatcher.Hide()
Application.Run()
def callback(code):
if code:
dispatcher.Invoke(CallTarget0(code))
else:
Application.Exit()
t = Thread(thread_proc)
t.Start()
IronPython.Hosting.PythonEngine.ExecWrapper = callback
The interactive session using IP from the released zip file
C:\IronPython-1.0-Beta1\Tutorial>ip.bat
IronPython 1.0.2190 (Beta) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import winforms
>>> from System.Windows.Forms import *
>>> f = Form()
>>> f.Show()
I hope this helps
Martin
-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Luis M. Gonzalez
Sent: Monday, January 02, 2006 4:09 PM
To: users at lists.ironpython.com
Subject: [IronPython] Avalon tutorial
> Changing the import statement in the winforms.py to be:
> from IronPython.Runtime import CallTarget0 will get you going on the
> winforms front.
Still not working...
>>> from IronPython.Runtime import CallTarget0
>>> from System.Windows.Forms import *
Traceback (most recent call last):
File , line 0, in input##1
ImportError: cannot import Windows from System
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
More information about the Ironpython-users
mailing list