sugar3.graphics.window module

STABLE.

class sugar3.graphics.window.UnfullscreenButton

Bases: Window

A ready-made “Unfullscreen” button.

Used by Window to exit fullscreen mode.

connect_button_clicked(cb)
do_get_preferred_width()

get_preferred_width(self) -> minimum_width:int, natural_width:int

class sugar3.graphics.window.Window(**args)

Bases: Window

An activity window.

Used as a container to display things that happen in an activity. A window must contain a canvas widget, and a toolbar box widget. A window may also contain alert message widgets and a tray widget.

Widgets are kept in a vertical box in this order;
  • toolbar box,

  • alerts,

  • canvas,

  • tray.

A window may be in fullscreen or non-fullscreen mode. In fullscreen mode, the toolbar and tray are hidden.

Motion events are tracked, and an unfullscreen button is shown when the mouse is moved into the top right corner of the canvas.

Key press events are tracked;
  • escape will cancel fullscreen mode,

  • Alt+space will toggle tray visibility.

add_alert(alert)

Add an alert to the window.

You must call Gtk.Widget. show() on the alert to make it visible.

Parameters:

alert (Alert) – the alert to add

property canvas

the Gtk.Widget to be shown as the canvas, below the toolbar and alerts, and above the tray.

Type:

Property

do_get_property(pspec)
do_set_property(pspec, value)
enable_fullscreen_mode

(bool) whether the window is allowed to enter fullscreen mode, default True.

Type:

Property

fullscreen()

Make the window fullscreen. The toolbar and tray will be hidden, and the UnfullscreenButton will be shown for a short time.

get_canvas()

Get canvas widget.

Returns:

the canvas

Return type:

Gtk.Widget

get_enable_fullscreen_mode()

Get enable fullscreen mode.

Returns:

enable fullscreen mode

Return type:

bool

get_toolbar_box()

Get ToolbarBox widget.

Returns:

the

current toolbar box of the window

Return type:

ToolbarBox

is_fullscreen()

Check if the window is fullscreen.

Returns:

window is fullscreen

Return type:

bool

remove_alert(alert)

Remove an alert message from the window.

Parameters:

alert (Alert) – the alert to remove

reveal()

Make window active.

Brings the window to the top and makes it active, even after invoking on response to non-GTK events (in contrast to present()). See bug #1423

set_canvas(canvas)

Set canvas widget.

Parameters:

canvas (Gtk.Widget) – the canvas to set

set_enable_fullscreen_mode(enable_fullscreen_mode)

Set enable fullscreen mode.

Parameters:

enable_fullscreen_mode (bool) – enable fullscreen mode

set_toolbar_box(toolbar_box)

Set ToolbarBox widget.

Parameters:

toolbar_box (ToolbarBox) – the toolbar box to set as current

set_tray(tray, position)

Set the tray.

Parameters:
property toolbar_box

the ToolbarBox to be shown above the alerts and canvas.

Type:

Property

unfullscreen()

Restore the window to non-fullscreen mode. The UnfullscreenButton will be hidden, and the toolbar and tray will be shown.