It looks like you're new here. If you want to get involved, click one of these buttons!
Hello Matthias
Looks like the MenuHandler code is being used quite often.
Can we get the equivalent of the Ruby code below for Python?
Thanks!
class MenuHandler < RBA::Action
def initialize( t, k, i, &action )
self.title = t
self.shortcut = k
self.icon = i
@action = action
end
def triggered
@action.call( self )
end
private
@action
end
menu.insert_item("@toolbar.end", "menu_item3", $menu_handler_transparent)
menu.insert_item("tools_menu.end", "menu_item3", $menu_handler_transparent)
Comments
Hi Mikamar,
Since some time now, the Action class does not need to be subclassed to implement a menu function. It's sufficient to use the "on_triggered" callback:
Matthias
Thank you Matthias!