KDE 4.7 PyKDE API Reference

- KDE's Python API

# KeyboardEvent Class Reference

`from PyKDE4.khtml import *`

Inherits: DOM.UIEvent → DOM.Event
Namespace: DOM

## Detailed Description

Introduced in DOM Level 3

DOM.KeyboardEvent The KeyboardEvent interface provides specific contextual information associated with keyboard devices. Each keyboard event references a key using an identifier. Keyboard events are commonly directed at the element that has the focus.

The KeyboardEvent interface provides convenient attributes for some common modifiers keys: KeyboardEvent.ctrlKey, KeyboardEvent.shiftKey, KeyboardEvent.altKey, KeyboardEvent.metaKey. These attributes are equivalent to use the method KeyboardEvent.getModifierState(keyIdentifierArg) with "Control", "Shift", "Alt", or "Meta" respectively.

To create an instance of the KeyboardEvent interface, use the DocumentEvent.createEvent("KeyboardEvent") method call.

## Enumerations
KeyLocation | { DOM_KEY_LOCATION_STANDARD, DOM_KEY_LOCATION_LEFT, DOM_KEY_LOCATION_RIGHT, DOM_KEY_LOCATION_NUMPAD }
## Methods
| __init__ (self)
| __init__ (self, DOM.KeyboardEvent other)
| __init__ (self, DOM.Event other)
bool | altKey (self)
bool | ctrlKey (self)
bool | getModifierState (self, DOM.DOMString keyIdentifierArg)
| initKeyboardEvent (self, DOM.DOMString typeArg, bool canBubbleArg, bool cancelableArg, DOM.AbstractView viewArg, DOM.DOMString keyIdentifierArg, long keyLocationArg, DOM.DOMString modifiersList)
DOM.DOMString | keyIdentifier (self)
long | keyLocation (self)
bool | metaKey (self)
bool | shiftKey (self)

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | DOM.KeyboardEvent | other
| ) |  |  |

__init__ | ( | self, |
|  | DOM.Event | other
| ) |  |  |

bool altKey | ( |  | self ) |

altKey of type boolean, readonly

true if the alt (Alt) key modifier is activated.

bool ctrlKey | ( |  | self ) |

ctrlKey of type boolean, readonly

true if the control (Ctrl) key modifier is activated.

bool getModifierState | ( | self, |
|  | DOM.DOMString | keyIdentifierArg
| ) |  |  |

getModifierState

This methods queries the state of a modifier using a key identifier

Parameters:

keyIdentifierArg of type DOMString A modifier key identifier. Supported modifier keys are "Alt", "Control", "Meta", "Shift".

Return Value boolean true if it is modifier key and the modifier is activated, false otherwise.

initKeyboardEvent | ( | self, |
|  | DOM.DOMString | typeArg,
|  | bool | canBubbleArg,
|  | bool | cancelableArg,
|  | DOM.AbstractView | viewArg,
|  | DOM.DOMString | keyIdentifierArg,
|  | long | keyLocationArg,
|  | DOM.DOMString | modifiersList
| ) |  |  |

initKeyboardEvent

The initKeyboardEvent method is used to initialize the value of a KeyboardEvent object and has the same behavior as UIEvent.initUIEvent(). The value of UIEvent.detail remains undefined.

Parameters: typeArg of type DOMString Specifies the event type. canBubbleArg of type boolean Specifies whether or not the event can bubble. cancelableArg of type boolean Specifies whether or not the event's default action can be prevent. viewArg of type views.AbstractView Specifies the TextEvent's AbstractView. keyIdentifierArg of type DOMString Specifies KeyboardEvent.keyIdentifier. keyLocationArg of type unsigned long Specifies KeyboardEvent.keyLocation. modifiersList of type DOMString A white space separated list of modifier key identifiers to be activated on this object.

DOM.DOMString keyIdentifier | ( |  | self ) |

keyIdentifier of type DOMString, readonly

keyIdentifier holds the identifier of the key. The key identifiers are defined in Appendix A.2 "Key identifiers set" (http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set)

long keyLocation | ( |  | self ) |

keyLocation of type unsigned long, readonly

The keyLocation attribute contains an indication of the location of they key on the device. See the KeyLocation enum for possible values

bool metaKey | ( |  | self ) |

metaKey of type boolean, readonly

true if the meta (Meta) key modifier is activated.

bool shiftKey | ( |  | self ) |

shiftKey of type boolean, readonly

true if the shift (Shift) key modifier is activated.

## Enumeration Documentation

KeyLocation

Enumerator:

  DOM_KEY_LOCATION_STANDARD = 0x00 |
  DOM_KEY_LOCATION_LEFT = 0x01 |
  DOM_KEY_LOCATION_RIGHT = 0x02 |
  DOM_KEY_LOCATION_NUMPAD = 0x03 |