[IronPython] How to make a gtk event?

Martin Matusiak numerodix at gmail.com
Wed Apr 13 18:41:15 CEST 2011

I'm not talking about the handler, I'm talking about creating a new
event for this widget. As in:

mywidget.SomethingHappened += some_handler

2011/4/13 Dino Viehland <dinov at microsoft.com>:
> Martin wrote:
>> Hey guys,
>> I'm writing a program using using gtk# and I have a custom widget that I want
>> to make an event for. Here is what an event looks like:
>> >>> print self.mainwindow.Shown
>> <IronPython.Runtime.Types.ReflectedEvent+BoundEvent object at
>> 0x000000000000002B
>> [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]>
>> So I seem to need to instantiate this type with my event name and trigger
>> function somehow as parameters, but I don't know how. Any ideas?
> The BoundEvent object supports in place addition and subtraction for adding/removing
> the events and it'll accept any callable object on the right hand side.  So you should just do
> += on shown, such as:
> def handler(sender, args):
>    print('hello')
> self.mainwindow.shown += handler
> _______________________________________________
> 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