Package parpg :: Package gui :: Module menus :: Class ContextMenu
[hide private]
[frames] | no frames]

Class ContextMenu

source code

object --+
         |
        ContextMenu

Instance Methods [hide private]
 
__init__(self, engine, menu_items, pos)
Returns: None
source code
 
show(self)
Shows the context menu
source code
 
hide(self)
Hides the context menu
source code
 
actionDecorator(self, func, *args, **kwargs)
This function is supposed to add some generic that should be executed before and/or after an action is fired through the context menu.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, engine, menu_items, pos)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • engine (engine.Engine) - An instance of the class Engine from engine.py
  • menu_items (list) - A list of items containing the name and text for the menu item and callback i.e. [["menu", "Some text", Callback]
  • pos ((int, int)) - Screen position to use
Returns:
None
Overrides: object.__init__

actionDecorator(self, func, *args, **kwargs)

source code 

This function is supposed to add some generic that should be executed before and/or after an action is fired through the context menu.

Parameters:
  • func (Any callable) - The original action function
  • args - Unpacked list of positional arguments
  • kwargs - Unpacked list of keyword arguments
Returns:
A wrapped version of func