Skip to content

Window

The window library allows the creation, destruction and editing of a window.

Usage

To import the window library into your script, use the following code:

import tailwindall.window as window

Creating a Window

To create a window, use the following code:

import tailwindall.window as window
import tailwindall.util as util
win = window.Window(None, "My Window", util.WindowProperties())

Arguments

NameTypeDescriptionDefaultSee Also
stylestyles.StyleThe style of the windowNo DefaultStyles
titlestrThe title of the windowNo Default
propertiesutil.WindowPropertiesThe properties of the windowNo DefaultWindow Properties
onTickfunction(win: window.Window)The function to call every tickNone
debugboolWhether or not to print debug informationFalse

Destroying a Window

To destroy a window, use the following code:

import tailwindall.window as window
import tailwindall.util as util
win = window.Window(None, "My Window", util.WindowProperties())
# Other code here
win.quit()

Arguments

NameTypeDescriptionDefaultSee Also
None

Main Loop

To start the main loop of the window, use the following code:

import tailwindall.window as window
import tailwindall.util as util
win = window.Window(None, "My Window", util.WindowProperties())
# Other code here
win.main_loop()

By default does not run in a thread. To run in a thread, use the following code:

import tailwindall.window as window
import tailwindall.util as util
import threading
win = window.Window(None, "My Window", util.WindowProperties())
# Other code here
thread = threading.Thread(target=win.main_loop, daemon=True)
thread.start()

Arguments

NameTypeDescriptionDefaultSee Also
None

Add Widget

To add a widget to the window, use the following code:

import tailwindall.window as window
import tailwindall.util as util
import tailwindall.widgets as widgets
win = window.Window(None, "My Window", util.WindowProperties())
# Other code here
label = widgets.Label(win, "Hello World!")
win.add_widget(label, util.PlaceData(0, 0, util.CenterAnchor.get_anchor()))
win.main_loop()

Arguments

NameTypeDescriptionDefaultSee Also
widgetwidgets.WidgetThe widget to add to the windowNo DefaultWidgets
placeutil.PlaceDataThe place data to use to place the widgetNo DefaultPlace Data