[IronPython] Delegates

Herny Johnson SomethingNew2_0 at hotmail.com
Wed Feb 6 18:55:52 CET 2008


I'm trying to put Xna on a Windows Form and the best idea that I've found so far was at http://creators.xna.com/Headlines/developmentaspx/archive/2007/01/01/WinForms-Series-1_3A00_--Graphics-Device.aspx.  In a nut shell it's quite easy to translate the C# code to IronPython to see if it will actually work for IronPython.  That is until the C# code:

C#
    // Hook the idle event to constantly redraw our animation.
    Application.Idle += delegate { Invalidate(); };
This makes it so the Xna control that you create it constantly redrawn, not just every button click or other event.  This code is found in the SpinningTriangleControl.cs of the zipfile if you want to see more of how it works. My question is how do I create a delegate or equivalent in IronPython?  I've tried using System.Delegate, but I'm not sure how to use it correctly.  Also I've tried just usingApplication.Idle += self.Invalidate (called or uncalled) and that doesn't work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080206/21ffbdc6/attachment.html>


More information about the Ironpython-users mailing list