This method is used to set the GdkEventMask flags on a widget, extending the type of event that the widget can capture from its default capabilities. You may need to do this, for instance, to capture a key press event on a widget that does not normally capture such events.
set_events() can be used at any point in the widget's life-cycle.
Staying with the key-press example, the syntax would be: $widget->set_events(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); This would enable a previously keyboard-insensitive widget to emit "key-press-event" and "key-release-event" signals.