Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    Dear Klayouters, I would like to assign a keyboard shortcut for a (python/ruby) macro that I have created. Can you give me a hint on how to do this? I tried to find a solution by going through the API, but could not find anything suitable for this purpose.

    Thanks for help!



    Found the solution - python example below. Markdown seems not to work for code blocks?


    import pya

    win = pya.Application.instance().main_window()

    def keyfun():

    print("key pressed")

    pya.QMessageBox.information(None, "Message", "Key pressed.")

    keyseq = pya.QKeySequence("K")

    shortcut = pya.QShortcut(keyseq, win);



    I was blind: of course the intended way to do this is through the macro properties dialog, where a keyboard shortcut can be defined!
    Anyways, the above example shows how to do it with code.
    • CommentAuthorMatthias
    • CommentTimeMay 31st 2016 edited

    Well, maybe not blind ... but creative :-)

    Thanks for sharing the sample. You can format it as code by prepending four blanks for every code line (that's Markdown markup). That is in particular important for Python.