Package pyHook :: Module HookManager :: Class HookManager
[show private | hide private]
[frames | no frames]

Type HookManager

object --+
         |
        HookManager


Registers and manages callbacks for low level mouse and keyboard events.
Method Summary
  __init__(self)
Initializes an instance by setting up an empty set of handlers.
  __del__(self)
Unhook all registered hooks.
  connect(self, switch, id, func)
Registers a callback to the given function for the event with the given ID in the provided dictionary.
  disconnect(self, switch, id)
Unregisters a callback for the event with the given ID in the provided dictionary.
  HookKeyboard(self)
Begins watching for keyboard events.
  HookMouse(self)
Begins watching for mouse events.
  KeyboardSwitch(self, msg, vk_code, scan_code, ascii, flags, time, hwnd, win_name)
Passes a keyboard event on to the appropriate handler if one is registered.
  MouseSwitch(self, msg, x, y, data, flags, time, hwnd, window_name)
Passes a mouse event on to the appropriate handler if one is registered.
  SubscribeKeyAll(self, func)
Registers the given function as the callback for all keyboard events.
  SubscribeKeyChar(self, func)
Registers the given function as the callback for this keyboard event type.
  SubscribeKeyDown(self, func)
Registers the given function as the callback for this keyboard event type.
  SubscribeKeyUp(self, func)
Registers the given function as the callback for this keyboard event type.
  SubscribeMouseAll(self, func)
Registers the given function as the callback for all mouse events.
  SubscribeMouseAllButtons(self, func)
Registers the given function as the callback for all mouse button events.
  SubscribeMouseAllButtonsDbl(self, func)
Registers the given function as the callback for all mouse button double click events.
  SubscribeMouseAllButtonsDown(self, func)
Registers the given function as the callback for all mouse button down events.
  SubscribeMouseAllButtonsUp(self, func)
Registers the given function as the callback for all mouse button up events.
  SubscribeMouseLeftDbl(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseLeftDown(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseLeftUp(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseMiddleDbl(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseMiddleDown(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseMiddleUp(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseMove(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseRightDbl(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseRightDown(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseRightUp(self, func)
Registers the given function as the callback for this mouse event type.
  SubscribeMouseWheel(self, func)
Registers the given function as the callback for this mouse event type.
  UnhookKeyboard(self)
Stops watching for keyboard events.
  UnhookMouse(self)
Stops watching for mouse events.
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Property Summary
  KeyAll
  KeyChar
  KeyDown
  KeyUp
  MouseAll
  MouseAllButtons
  MouseAllButtonsDbl
  MouseAllButtonsDown
  MouseAllButtonsUp
  MouseLeftDbl
  MouseLeftDown
  MouseLeftUp
  MouseMiddleDbl
  MouseMiddleDown
  MouseMiddleUp
  MouseMove
  MouseRightDbl
  MouseRightDown
  MouseRightUp
  MouseWheel

Instance Variable Summary
boolean key_hook: Is a keyboard hook set?
dictionary keyboard_funcs: Callbacks for keyboard events
dictionary mouse_funcs: Callbacks for mouse events
boolean mouse_hook: Is a mouse hook set?

Method Details

__init__(self)
(Constructor)

Initializes an instance by setting up an empty set of handlers.
Overrides:
__builtin__.object.__init__

__del__(self)
(Destructor)

Unhook all registered hooks.

connect(self, switch, id, func)

Registers a callback to the given function for the event with the given ID in the provided dictionary. Internal use only.
Parameters:
switch - Collection of callbacks
           (type=dictionary)
id - Event type
           (type=integer)
func - Callback function
           (type=callable)

disconnect(self, switch, id)

Unregisters a callback for the event with the given ID in the provided dictionary. Internal use only.
Parameters:
switch - Collection of callbacks
           (type=dictionary)
id - Event type
           (type=integer)

HookKeyboard(self)

Begins watching for keyboard events.

HookMouse(self)

Begins watching for mouse events.

KeyboardSwitch(self, msg, vk_code, scan_code, ascii, flags, time, hwnd, win_name)

Passes a keyboard event on to the appropriate handler if one is registered.
Parameters:
msg - Message value
           (type=integer)
vk_code - The virtual keycode of the key
           (type=integer)
scan_code - The scan code of the key
           (type=integer)
ascii - ASCII numeric value for the key if available
           (type=integer)
flags - Flags associated with the key event (injected or not, extended key, etc.)
           (type=integer)
time - Time since the epoch of the key event
           (type=integer)
hwnd - Window handle of the foreground window at the time of the event
           (type=integer)

MouseSwitch(self, msg, x, y, data, flags, time, hwnd, window_name)

Passes a mouse event on to the appropriate handler if one is registered.
Parameters:
msg - Message value
           (type=integer)
x - x-coordinate of the mouse event
           (type=integer)
y - y-coordinate of the mouse event
           (type=integer)
data - Data associated with the mouse event (scroll information)
           (type=integer)
flags - Flags associated with the mouse event (injected or not)
           (type=integer)
time - Seconds since the epoch when the even current
           (type=integer)
hwnd - Window handle of the foreground window at the time of the event
           (type=integer)

SubscribeKeyAll(self, func)

Registers the given function as the callback for all keyboard events. Use the KeyAll property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeKeyChar(self, func)

Registers the given function as the callback for this keyboard event type. Use the KeyChar property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeKeyDown(self, func)

Registers the given function as the callback for this keyboard event type. Use the KeyDown property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeKeyUp(self, func)

Registers the given function as the callback for this keyboard event type. Use the KeyUp property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseAll(self, func)

Registers the given function as the callback for all mouse events. Use the MouseAll property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseAllButtons(self, func)

Registers the given function as the callback for all mouse button events. Use the MouseButtonAll property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseAllButtonsDbl(self, func)

Registers the given function as the callback for all mouse button double click events. Use the MouseAllButtonsDbl property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseAllButtonsDown(self, func)

Registers the given function as the callback for all mouse button down events. Use the MouseAllButtonsDown property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseAllButtonsUp(self, func)

Registers the given function as the callback for all mouse button up events. Use the MouseAllButtonsUp property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseLeftDbl(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseLeftDbl property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseLeftDown(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseLeftDown property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseLeftUp(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseLeftUp property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseMiddleDbl(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseMiddleDbl property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseMiddleDown(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseMiddleDown property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseMiddleUp(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseMiddleUp property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseMove(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseMove property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseRightDbl(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseRightDbl property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseRightDown(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseRightDown property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseRightUp(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseRightUp property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

SubscribeMouseWheel(self, func)

Registers the given function as the callback for this mouse event type. Use the MouseWheel property as a shortcut.
Parameters:
func - Callback function
           (type=callable)

UnhookKeyboard(self)

Stops watching for keyboard events.

UnhookMouse(self)

Stops watching for mouse events.

Property Details

KeyAll

Set Method:
SubscribeKeyAll(self, func)

KeyChar

Set Method:
SubscribeKeyChar(self, func)

KeyDown

Set Method:
SubscribeKeyDown(self, func)

KeyUp

Set Method:
SubscribeKeyUp(self, func)

MouseAll

Set Method:
SubscribeMouseAll(self, func)

MouseAllButtons

Set Method:
SubscribeMouseAllButtons(self, func)

MouseAllButtonsDbl

Set Method:
SubscribeMouseAllButtonsDbl(self, func)

MouseAllButtonsDown

Set Method:
SubscribeMouseAllButtonsDown(self, func)

MouseAllButtonsUp

Set Method:
SubscribeMouseAllButtonsUp(self, func)

MouseLeftDbl

Set Method:
SubscribeMouseLeftDbl(self, func)

MouseLeftDown

Set Method:
SubscribeMouseLeftDown(self, func)

MouseLeftUp

Set Method:
SubscribeMouseLeftUp(self, func)

MouseMiddleDbl

Set Method:
SubscribeMouseMiddleDbl(self, func)

MouseMiddleDown

Set Method:
SubscribeMouseMiddleDown(self, func)

MouseMiddleUp

Set Method:
SubscribeMouseMiddleUp(self, func)

MouseMove

Set Method:
SubscribeMouseMove(self, func)

MouseRightDbl

Set Method:
SubscribeMouseRightDbl(self, func)

MouseRightDown

Set Method:
SubscribeMouseRightDown(self, func)

MouseRightUp

Set Method:
SubscribeMouseRightUp(self, func)

MouseWheel

Set Method:
SubscribeMouseWheel(self, func)

Instance Variable Details

key_hook

Is a keyboard hook set?
Type:
boolean

keyboard_funcs

Callbacks for keyboard events
Type:
dictionary

mouse_funcs

Callbacks for mouse events
Type:
dictionary

mouse_hook

Is a mouse hook set?
Type:
boolean

Generated by Epydoc 2.1 on Wed Feb 23 16:53:22 2005 http://epydoc.sf.net