pyface.i_window module

The abstract interface for all pyface top-level windows.

class pyface.i_window.IWindow

Bases: pyface.i_widget.IWidget

The abstract interface for all pyface top-level windows.

A pyface top-level window has no visual representation until it is opened (ie. its ‘control’ trait will be None until it is opened).

position = Tuple()

The position of the window.

size = Tuple()

The size of the window.

title = Str()

The window title.

opened = Event()

The window has been opened.

opening = VetoableEvent()

The window is about to open.

activated = Event()

The window has been activated.

closed = Event()

The window has been closed.

closing = VetoableEvent()

The window is about to be closed.

deactivated = Event()

The window has been deactivated.

open()

Opens the window.

This fires the closing vetoable event, giving listeners the opportunity to veto the opening of the window.

If the window is opened, the opened event will be fired with the IWindow instance as the event value.

Returns

opened – Whether or not the window was opened.

Return type

bool

close(force=False)

Closes the window.

This fires the closing vetoable event, giving listeners the opportunity to veto the closing of the window. If force is True then the window will close no matter what.

If the window is closed, the closed event will be fired with the window object as the event value.

Parameters

force (bool) – Whether the window should close despite vetos.

Returns

closed – Whether or not the window is closed.

Return type

bool

confirm(message, title=None, cancel=False, default=40)

Convenience method to show a confirmation dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • cancel (bool) – True if the dialog should contain a Cancel button.

  • default (NO, YES or CANCEL) – Which button should be the default button.

information(message, title='Information', detail='', informative='')

Convenience method to show an information message dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • detail (str) – Further details about the message.

  • informative (str) – Explanatory text to display along with the message.

warning(message, title='Warning', detail='', informative='')

Convenience method to show a warning message dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • detail (str) – Further details about the message.

  • informative (str) – Explanatory text to display along with the message.

error(message, title='Error', detail='', informative='')

Convenience method to show an error message dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • detail (str) – Further details about the message.

  • informative (str) – Explanatory text to display along with the message.

class pyface.i_window.MWindow

Bases: traits.has_traits.HasTraits

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

Implements: close(), confirm(), open() Reimplements: _create()

open()

Opens the window.

This fires the closing vetoable event, giving listeners the opportunity to veto the opening of the window.

If the window is opened, the opened event will be fired with the IWindow instance as the event value.

Returns

opened – Whether or not the window was opened.

Return type

bool

close(force=False)

Closes the window.

This fires the closing vetoable event, giving listeners the opportunity to veto the closing of the window. If force is True then the window will close no matter what.

If the window is closed, the closed event will be fired with the window object as the event value.

Parameters

force (bool) – Whether the window should close despite vetos.

Returns

closed – Whether or not the window is closed.

Return type

bool

confirm(message, title=None, cancel=False, default=40)

Convenience method to show a confirmation dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • cancel (bool) – True if the dialog should contain a Cancel button.

  • default (NO, YES or CANCEL) – Which button should be the default button.

information(message, title='Information', detail='', informative='')

Convenience method to show an information message dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • detail (str) – Further details about the message.

  • informative (str) – Explanatory text to display along with the message.

warning(message, title='Warning', detail='', informative='')

Convenience method to show a warning message dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • detail (str) – Further details about the message.

  • informative (str) – Explanatory text to display along with the message.

error(message, title='Error', detail='', informative='')

Convenience method to show an error message dialog.

Parameters
  • message (str) – The text of the message to display.

  • title (str) – The text of the dialog title.

  • detail (str) – Further details about the message.

  • informative (str) – Explanatory text to display along with the message.