You need to match the signature of Application.Idle. But once you have the right signature += should work. It looks like Idle is just an EventHandler so:
def MyIdle(self, sender, eventArgs): self.Invalidate() Application.Idle += self.MyIdle Should work. And to make it more like the C# version you can use a lambda: Application.Idle += lambda sender, ea: self.Invalidate() From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Herny Johnson Sent: Wednesday, February 06, 2008 9:56 AM To: users@lists.ironpython.com Subject: [IronPython] Delegates 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 zip file 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 using Application.Idle += self.Invalidate (called or uncalled) and that doesn't work.
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com