pyface.i_gui module

The interface of a pyface GUI.

class pyface.i_gui.IGUI(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: traits.has_traits.Interface

The interface of a pyface GUI.

busy = Bool(False)

Is the GUI busy (i.e. should the busy cursor, often an hourglass, be displayed)?

started = Bool(False)

Has the GUI’s event loop been started?

state_location = Str()

A directory on the local file system that we can read and write to at will. This is used to persist layout information etc. Note that individual toolkits will have their own directory.

static allow_interrupt()[source]

Override SIGINT to prevent swallowing KeyboardInterrupt

Override the SIGINT handler to ensure the process can be interrupted. This prevents GUI toolkits from swallowing KeyboardInterrupt exceptions.

Warning: do not call this method if you intend your application to be run interactively.

classmethod invoke_after(millisecs, callable, *args, **kw)[source]

Call a callable after a specific delay in the main GUI thread.

Parameters
  • millisecs (float) – Delay in milliseconds

  • callable (callable) – Callable to be called after the delay

  • args – Arguments and keyword arguments to be used when calling.

  • kwargs – Arguments and keyword arguments to be used when calling.

classmethod invoke_later(callable, *args, **kw)[source]

Call a callable in the main GUI thread.

Parameters
  • callable (callable) – Callable to be called after the delay

  • args – Arguments and keyword arguments to be used when calling.

  • kwargs – Arguments and keyword arguments to be used when calling.

classmethod set_trait_after(millisecs, obj, trait_name, new)[source]

Sets a trait after a specific delay in the main GUI thread.

Parameters
  • millisecs (float) – Delay in milliseconds

  • obj (HasTraits instance) – Object on which the trait is to be set

  • trait_name (str) – The name of the trait to set

  • new (any) – The value to set.

classmethod set_trait_later(obj, trait_name, new)[source]

Sets a trait in the main GUI thread.

Parameters
  • obj (HasTraits instance) – Object on which the trait is to be set

  • trait_name (str) – The name of the trait to set

  • new (any) – The value to set.

static process_events(allow_user_events=True)[source]

Process any pending GUI events.

Parameters

allow_user_events (bool) – If allow_user_events is False then user generated events are not processed.

static set_busy(busy=True)[source]

Specify if the GUI is busy.

Parameters

busy (bool) – If True is passed, the cursor is set to a ‘busy’ cursor. Passing False will reset the cursor to the default.

start_event_loop()[source]

Start the GUI event loop.

stop_event_loop()[source]

Stop the GUI event loop.

class pyface.i_gui.MGUI[source]

Bases: traits.has_traits.HasTraits

The mixin class that contains common code for toolkit specific implementations of the IGUI interface.

Implements: _default_state_location()

static allow_interrupt()[source]

Override SIGINT to prevent swallowing KeyboardInterrupt

Override the SIGINT handler to ensure the process can be interrupted. This prevents GUI toolkits from swallowing KeyboardInterrupt exceptions.

Warning: do not call this method if you intend your application to be run interactively.