Re: [Sikuli-driver] [Question #670913]: Get key name in python

2018-07-16 Thread Dillon
Question #670913 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/670913

Status: Open => Solved

Dillon confirmed that the question is solved:
Works splendidly! Thank you very much.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #670913]: Get key name in python

2018-07-16 Thread Alex
Question #670913 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/670913

Alex posted a new comment:
I'm not aware of the existence of this functionality. The [Key
Constants](http://sikulix-2014.readthedocs.io/en/latest/keys.html) help
page lists all of the available special keys. It would be trivial to
make a function that did this:

def print_special_key_string(key):
"""
Given a special key constant return a string.
:param key:
:return:
"""
if 'Key.' in key:
key = key.replace('Key.', '')  # Strip the 'Key.' text if it exists.

key_dict = {
u'\r': 'Enter',
u'': 'Window',
u'': 'Escape',
u'': 'ALT'
}

if key in key_dict:
return key_dict[key]
else:
raise ValueError('Unable to locate %s in the Special Key dictionary.' % 
key)


print(print_special_key_string(Key.WIN))

I couldn't paste the full list in but you get the idea. Make sure you
set the encoding at the top of your file:

# -*- coding: utf-8 -*-

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #670913]: Get key name in python

2018-07-16 Thread Dillon
Question #670913 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/670913

Status: Needs information => Open

Dillon gave more information on the question:
Post updated.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #670913]: Get key name in python

2018-07-16 Thread Dillon
Question #670913 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/670913

Description changed to:
Is there a function to get the name of a key as a string in Python?
Example str(Key.WIN) -> "Windows"

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #670913]: Get key name in python

2018-07-16 Thread Alex
Question #670913 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/670913

Status: Open => Needs information

Alex requested more information:
Can you provide more information? The following commands work fine in
Sikuli:


CTRL+A to select all
type('a', Key.CTRL)

type(Key.TAB, Key.ALT)

I'm not really sure what you are asking but I would be happy to help.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #670913]: Get key name in python

2018-07-16 Thread Dillon
New question #670913 on Sikuli:
https://answers.launchpad.net/sikuli/+question/670913

Is there a function to the name as a string of a key in Python like Key.CTRL?

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp