type(Key.F4, Key_ALT) is throwing an error

Asked by Sneha on 2020-03-13

For closing a window using Sikuli, type(Key.F4, KEY_ALT) throws me Name error (name Key_ALT is not defined)

Can someone help me out?

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-03-13
Last reply:
2020-03-13
Manfred Hampl (m-hampl) said : #1

Read the documentation and check your error message.

https://sikulix-2014.readthedocs.io/en/latest/keys.html#key-modifiers-modifier-keys
For parameter 2 there are 2 options:
•new version: (a key is a key ;-): Key.XXX
•old version (kept for upwards compatibility): KeyModifier.XXX
… and these early versions should not be used anymore KEY_ALT, KEY_CTRL, KEY_SHIFT, KEY_WIN, KEY_CMD, KEY_META

Key_ALT has never existed.
Use Key.ALT instead.

Can you help with this problem?

Provide an answer of your own, or ask Sneha for more information if necessary.

To post a message you must log in.