The eg module

Everything special that is needed from EventGhost for scripting and writing plugins is stuffed into the eg module. It includes many functions, variables, classes and objects. You could actually say eg is EventGhost itself.



The eg.EventGhostEvent instance, that is currently been processed.


Namespace, that holds all global variables used by PythonCommand actions. PythonScripts (and all other code) can access these globals through eg.globals.


Instance of the single eg.Scheduler class.


class eg.PluginBase
Base class of every EventGhost plugin written in Python.
class eg.ActionBase
Base class of every action of a EventGhost plugin written in Python
class eg.SerialThread
Eased handling of serial port communication.
class eg.ThreadWorker
General purpose message pumping thread, that is used in many places.
class eg.ConfigPanel
A panel with some magic.
class eg.Bunch
Universal collection of a bunch of named stuff.
class eg.WindowMatcher
Returns a list of window handles matching a number of criteria.

wxPython Additions

class eg.SpinIntCtrl
A wx.Control that shows a integer value and spin buttons to let the user easily input an integer value.
class eg.SpinNumCtrl
A wx.Control that shows a fixed width floating point value and spin buttons to let the user easily input a floating point value.
class eg.MessageDialog
A replacement for wx.MessageDialog, that wraps the message, if the dialog would get to wide.
class eg.DisplayChoice
A wx.Choice control, that shows all available displays.
class eg.SerialPortChoice
A wx.Choice control that shows all available serial ports on the system.
class eg.FileBrowseButton
A control to allow the user to type in a filename or browse with the standard file dialog to select a file.
class eg.DirBrowseButton
A control to allow the user to type in a filename or browse with the standard file dialog to select a directory.
class eg.FontSelectButton
A button to select a font.



Sometimes you want to quickly exit a PythonScript, because you don’t want to build deeply nested if-structures for example. eg.Exit() will exit your PythonScript immediately. (Note: This is actually a sys.exit() but will not exit EventGhost, because the SystemExit exception is catched for a PythonScript.)


Instructs EventGhost to stop executing the current macro after the current action (thus the PythonScript or PythonCommand) has finished.

eg.TriggerEvent(self, suffix, payload=None, prefix='Main', source=<dynamic-module 'eg'>)

Trigger an event

eg.RegisterPlugin(name=None, description=None, kind='other', author='unknown author', version='unknown version', icon=None, canMultiLoad=False, createMacrosOnAdd=False, url=None, help=None, guid=None, **kwargs)

Registers information about a plugin to EventGhost.

  • name – should be a short descriptive string with the name of the plugin.
  • description – the description of the plugin.
  • kind – gives a hint about the category the plugin belongs to. It should be a string with a value out of “remote” (for remote receiver plugins), “program” (for program control plugins), “external” (for plugins that control external hardware) or “other” (if none of the other categories match).
  • author – can be set to the name of the developer of the plugin.
  • version – can be set to a version string.
  • canMultiLoad – set this to True, if a configuration can have more than one instance of this plugin.
  • **kwargs – just to consume unknown parameters, to make the call backward compatible.
eg.PrintError(self, *args, **kwargs)

Prints an error message to the logger. The message will get a special icon and a red colour, so the user can easily identify it as an error message.

Table Of Contents

Previous topic


This Page