pyface.gui_application module

This module defines a GUIApplication subclass of pyface.application.Application. This adds cross-platform GUI application support to the base class via pyface.application.GUI.

At a minimum this class expects to be provided with a factory that returns pyface.i_window.IWindow instances. For pure Pyface applications this is most likely to be a subclass of pyface.application_window.ApplicationWindow.

pyface.gui_application.default_window_factory(application, **kwargs)[source]

The default window factory returns an application window.

This is almost never the right thing, but allows users to get off the ground with the base class.

class pyface.gui_application.GUIApplication[source]

Bases: Application

A basic Pyface GUI application.

splash_screen = Instance(ISplashScreen)

The splash screen for the application. No splash screen by default

about_dialog = Instance(IDialog)

The about dialog for the application.

icon = Image

Icon for the application (used in window titlebars)

Logo of the application (used in splash screens and about dialogs)

window_factory = Callable(default_window_factory)

The window factory to use when creating a window for the application.

window_size = Tuple((800, 600))

Default window size

active_window = Instance(IWindow)

Currently active Window if any

windows = List(Instance(IWindow))

List of all open windows in the application

gui = ReadOnly

The Pyface GUI instance for the application

create_window(**kwargs)[source]

Create a new application window.

By default uses the window_factory to do this. Subclasses can override if they want to do something different or additional.

Parameters

**kwargs (dict) – Additional keyword arguments to pass to the window factory.

Returns

window – The new IWindow instance.

Return type

IWindow or None

add_window(window)[source]

Add a new window to the windows we are tracking.

do_about()[source]

Display the about dialog, if it exists.

start()[source]

Start the application, setting up things that are required

Subclasses should open at least one ApplicationWindow or subclass in their start method, and should call the superclass start() method before doing any work themselves.