Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5875

Keyboard Event handler for RhinoPython (RhinoApp.KeyboardEvent)

$
0
0

@Mr_Sinter wrote:

Hi @ all,

i was wondering how i can define a function or if-statement which is called or proceded when a defined keyboard button (lets say "esc") is hit?

something like:

import rhinoscriptsyntax as rs
import Rhino as rhi

if rhi.RhinoApp.EscapeKeyPressed is True:
    rs.MessageBox ("Center point of label was written to labelman_config.txt", buttons=0, title='Leaving Dialog')

But this does not work for me.
When I check what this element contains with
print "%s \n"%rhi.RhinoApp.EscapeKeyPressed

this gives me:
<IronPython.Runtime.Types.ReflectedEvent+BoundEvent object at 0x0000000000000080 [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]>

I dont know how to handle this.

Thanks a lot for suggestions!

Kind regards
Mr Sinter

Posts: 3

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5875

Trending Articles