Action cannot be reassigned

edited December 2017 in Python scripting

Hello,

I am having difficulties using the Action class in python. Attempting to use the assign function results in an exception:

pya.Application.instance().main_window().menu().action('path to action').assign(pya.Action())
argument 1 (impossible<bad format char>)

I cannot pass the assign function an action object successfully. Is there something I am doing incorrectly? I have also tried with an action that had an on_triggered event and title.

Comments

  • edited December 2017

    Hello,

    yes, thanks for mentioning this. Apparently something is wrong with the "assign" implementation in Python.

    But you can assign each property individually:

    new_a = ...
    old_a = pya.Application.instance().main_window().menu().action('path to action')
    old_a.title = new_a.title
    ... etc.
    

    Matthias

  • edited November -1

    I have created a ticket at GitHub: https://github.com/klayoutmatthias/klayout/issues/39

Sign In or Register to comment.