pyface.tasks.tasks_application module

Define a base Task application class to create the event loop, and launch the creation of tasks and corresponding windows.

class pyface.tasks.tasks_application.TaskFactory[source]

Bases: traits.has_traits.HasStrictTraits

A factory for creating a Task with some additional metadata.

id = Str()

The task factory’s unique identifier. This ID is assigned to all tasks created by the factory.

name = Str()

The task factory’s user-visible name.

factory = Callable

A callable with the following signature:

callable(**traits) -> Task

Often this attribute will simply be a Task subclass.


Creates the Task.

The default implementation simply calls the ‘factory’ attribute.

class pyface.tasks.tasks_application.TasksApplication[source]

Bases: pyface.gui_application.GUIApplication

A base class for Pyface tasks applications.

tasks = List(Instance("pyface.tasks.task.Task"))

List of all running tasks

active_task = Property(

Currently active Task if any.

task_factories = List()

List of all application task factories.

default_layout = List(

The default layout for the application. If not specified, a single window will be created with the first available task factory.

extra_actions = List(

Hook to add global schema additions to tasks/windows

extra_dock_pane_factories = List(Callable)

Hook to add global dock pane additions to tasks/windows


Creates the Task with the specified ID.


id (str) – The id of the task factory to use.


Return type

The new Task, or None if there is not a suitable TaskFactory.

create_window(layout=None, **kwargs)[source]

Connect task to application and open task in a new window.

  • layout (TaskLayout instance or None) – The pane layout for the window.

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


window – The new TaskWindow.

Return type

ITaskWindow instance or None