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 windowCreating a Window
To create a window, use the following code:
import tailwindall.window as windowimport tailwindall.util as util
win = window.Window(None, "My Window", util.WindowProperties())Arguments
| Name | Type | Description | Default | See Also |
|---|---|---|---|---|
| style | styles.Style | The style of the window | No Default | Styles |
| title | str | The title of the window | No Default | |
| properties | util.WindowProperties | The properties of the window | No Default | Window Properties |
| onTick | function(win: window.Window) | The function to call every tick | None | |
| debug | bool | Whether or not to print debug information | False |
Destroying a Window
To destroy a window, use the following code:
import tailwindall.window as windowimport tailwindall.util as util
win = window.Window(None, "My Window", util.WindowProperties())
# Other code here
win.quit()Arguments
| Name | Type | Description | Default | See Also |
|---|---|---|---|---|
| None |
Main Loop
To start the main loop of the window, use the following code:
import tailwindall.window as windowimport 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 windowimport tailwindall.util as utilimport threading
win = window.Window(None, "My Window", util.WindowProperties())
# Other code here
thread = threading.Thread(target=win.main_loop, daemon=True)thread.start()Arguments
| Name | Type | Description | Default | See Also |
|---|---|---|---|---|
| None |
Add Widget
To add a widget to the window, use the following code:
import tailwindall.window as windowimport tailwindall.util as utilimport 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
| Name | Type | Description | Default | See Also |
|---|---|---|---|---|
| widget | widgets.Widget | The widget to add to the window | No Default | Widgets |
| place | util.PlaceData | The place data to use to place the widget | No Default | Place Data |