-
-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa452d8
commit dcaf939
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Documentation for ``toga.Key`` was added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Keys | ||
==== | ||
|
||
A symbolic representation of keys used for keyboard shortcuts. | ||
|
||
Most keys have a constant that matches the text on the key, or the name of the | ||
key if the text on the key isn't a legal Python identifier. | ||
|
||
However, due to differences between platforms, there's no representation of | ||
"modifier" keys like Control, Command, Option, or the Windows Key. Instead, Toga | ||
provides three generic modifier constants, and maps those to the modifier keys, | ||
matching the precedence with which they are used on the underlying platforms: | ||
|
||
========== ============== ============== ================== | ||
Platform :any:`MOD_1` :any:`MOD_2` :any:`MOD_3` | ||
========== ============== ============== ================== | ||
Linux Control Alt Tux/Windows/Meta | ||
macOS Command (⌘) Option Control (^) | ||
Windows Control Alt Not supported | ||
========== ============== ============== ================== | ||
|
||
Key combinations can be expressed by combining multiple ``Key`` values with the | ||
``+`` operator. | ||
|
||
.. code-block:: python | ||
from toga import Key | ||
just_an_a = Key.A | ||
shift_a = Key.SHIFT + Key.A | ||
# Windows/Linux - Control-Shift-A: | ||
# macOS - Command-Shift-A: | ||
modified_shift_a = Key.MOD_1 + Key.SHIFT + Key.A | ||
The order of addition is not significant. ``Key.SHIFT + Key.A`` and ``Key.A + | ||
Key.SHIFT`` will produce the same key representation. | ||
|
||
Reference | ||
--------- | ||
|
||
.. autoclass:: toga.Key |