Window

A window for displaying components to the user

Usage

The window class is used for desktop applications, where components need to be shown within a window-manager. Windows can be configured on instantiation and support displaying multiple widgets, toolbars and resizing.

import toga

window = toga.Window('my window', title='This is a window!')
window.show()

Supported Platforms

Component iOS win32 web django cocoa gtk android
Window yes yes no yes yes yes yes

Reference

class toga.interface.window.Window(id_=None, title=None, position=(100, 100), size=(640, 480), resizeable=True, closeable=True, minimizable=True)

Instantiates a window

Parameters:
  • id (str) – The ID of the window (optional)
  • title (str) – Title for the window (optional)
  • position (tuple of (int, int)) – Position of the window, as x,y coordinates
  • size (tuple of (int, int)) – Size of the window, as (width, height) sizes, in pixels
  • resizable (bool) – Toggle if the window is resizable by the user, defaults to True.
  • closable (bool) – Toggle if the window is closable by the user, defaults to True.
  • minimizable (bool) – Toggle if the window is minimizable by the user, defaults to True.
app

Instance of the toga.App that this window belongs to

Return type:toga.App
confirm_dialog(title, message)
content

Content of the window

Return type:toga.Widget
error_dialog(title, message)
info_dialog(title, message)
on_close()
position

Position of the window, as x, y

Return type:tuple of (int, int)
question_dialog(title, message)
save_file_dialog(title, suggested_filename, file_types)
show()

Show window, if hidden

size

Size of the window, as width, height

Return type:tuple of (int, int)
stack_trace_dialog(title, message, content, retry=False)
title

Title of the window

Return type:str
toolbar

Commands registered for display on the toolbar.

Return type:CommandSet