Welcome to the Pyface Documentation!¶
Pyface contains toolkit-independent GUI abstraction layers, used to support the TraitsUI package. Thus, you can write code in the abstraction of the Pyface API and the selected toolkit and backend take care of the details of displaying them.
Pyface enables programmers to interact with generic GUI objects, such as an “Application Window”, rather than with raw GUI widgets. TraitsUI uses Pyface to implement views and editors for displaying and editing Traits-based objects. In addition to wrappers around fields and dialogs, Pyface includes an application framework called “Tasks” for building full-featured applications featuring dock panes, tabbed editor areas and so forth.
Toolkit Backends¶
Pyface defines APIs that are independent of any GUI toolkit. However, in order to actually produce user interfaces with them, you must install a supported Python-based GUI toolkit and the appropriate toolkit-specific backend project. Conversely, a “null” backend is automatically used in the absence of a real backend.
Currently, the GUI toolkits are
PySide2 and PySide6 (stable)
PyQt5 (stable) and PyQt6 (in development)
wxPython 4 (experimental)
NOTE: Although the code in this library is BSD licensed, when a PyQt backend is used, the more restrictive terms of PyQt’s GPL or proprietary licensing will likely apply to your code.
Toolkit Backend Selection¶
Selecting the backend to use is possible via the singleton object ETSConfig (importable from traits.etsconfig.api), which has a string attribute, toolkit, that signifies the GUI toolkit.
The supported values of ETSConfig.toolkit are:
‘qt’ or ‘qt4’: PySide2, PySide6 or PyQt, which provide Python bindings for the Qt framework.
‘wx’: wxPython 4, which provides Python bindings for the wxWidgets toolkit.
‘null’: A do-nothing toolkit, for situations where neither of the other toolkits is installed.
The default behavior of Pyface is to search for available toolkit-specific packages in the order listed, and uses the first one it finds. The programmer or the user can override this behavior in any of several ways, in the following order of precedence:
The program can explicitly set ETSConfig.toolkit. It must do this before importing from any other Enthought Tool Suite component, including traits. For example, at the beginning of a program:
from traits.etsconfig.api import ETSConfig ETSConfig.toolkit = 'wx'
The user can define a value for the ETS_TOOLKIT environment variable.
Contents¶
- Overview
- Toolkits
- Widgets
- Pyface Applications
- Pyface Trait Types
- Images in Pyface
- Standard Dialogs
- Submodules
- Testing
- API Documentation
- Subpackages
- pyface.action package
- pyface.data_view package
- pyface.fields package
- pyface.image package
- pyface.preference package
- pyface.resource package
- pyface.sizers package
- pyface.tasks package
- pyface.testing package
- pyface.timer package
- pyface.tree package
- pyface.ui package
- pyface.undo package
- pyface.util package
- pyface.viewer package
- pyface.wizard package
- pyface.workbench package
- Submodules
- pyface.about_dialog module
- pyface.api module
- pyface.application module
- pyface.application_window module
- pyface.array_image module
- pyface.base_toolkit module
- pyface.beep module
- pyface.clipboard module
- pyface.color module
- pyface.color_dialog module
- pyface.confirmation_dialog module
- pyface.constant module
- pyface.dialog module
- pyface.directory_dialog module
- pyface.drop_handler module
- pyface.expandable_panel module
- pyface.file_dialog module
- pyface.filter module
- pyface.font module
- pyface.font_dialog module
- pyface.gui module
- pyface.gui_application module
- pyface.heading_text module
- pyface.i_about_dialog module
- pyface.i_application_window module
- pyface.i_clipboard module
- pyface.i_color_dialog module
- pyface.i_confirmation_dialog module
- pyface.i_dialog module
- pyface.i_directory_dialog module
- pyface.i_drop_handler module
- pyface.i_file_dialog module
- pyface.i_font_dialog module
- pyface.i_gui module
- pyface.i_heading_text module
- pyface.i_image module
- pyface.i_image_cache module
- pyface.i_image_resource module
- pyface.i_layered_panel module
- pyface.i_layout_item module
- pyface.i_layout_widget module
- pyface.i_message_dialog module
- pyface.i_pil_image module
- pyface.i_progress_dialog module
- pyface.i_python_editor module
- pyface.i_python_shell module
- pyface.i_single_choice_dialog module
- pyface.i_splash_screen module
- pyface.i_split_widget module
- pyface.i_system_metrics module
- pyface.i_widget module
- pyface.i_window module
- pyface.image_cache module
- pyface.image_resource module
- pyface.image_widget module
- pyface.key_pressed_event module
- pyface.layered_panel module
- pyface.layout_widget module
- pyface.list_box module
- pyface.list_box_model module
- pyface.mdi_application_window module
- pyface.mdi_window_menu module
- pyface.message_dialog module
- pyface.mimedata module
- pyface.multi_toolbar_window module
- pyface.pil_image module
- pyface.progress_dialog module
- pyface.python_editor module
- pyface.python_shell module
- pyface.resource_manager module
- pyface.single_choice_dialog module
- pyface.sorter module
- pyface.splash_screen module
- pyface.splash_screen_log_handler module
- pyface.split_application_window module
- pyface.split_dialog module
- pyface.split_panel module
- pyface.split_widget module
- pyface.system_metrics module
- pyface.toolkit module
- pyface.ui_traits module
- pyface.widget module
- pyface.window module
- Subpackages
- Change Log
- Release 8.0.0
- Release 7.4.4
- Release 7.4.3
- Release 7.4.2
- Release 7.4.1
- Release 7.4.0
- Release 7.3.0
- Release 7.2.0
- Release 7.1.0
- Release 7.0.1
- Release 7.0.0
- Release 6.1.2
- Release 6.1.1
- Release 6.1.0
- Release 6.0.0
- Release 5.1.0
- Release 5.0.0
- Release 4.5.2
- Release 4.5.1
- Release 4.5.0
- Release 4.4.0
- TraitsGUI 3.1.0 (July 15, 2009)