Page
Page is the top most container for all other controls. It is is automatically added when a new page is created or app session started.
Page control has a reserved page
control ID. You cannot add Page control, however you can change its properties. Technically, the Page is a vertical Stack control, so it has similar behavior and shares some properties.
Properties
Name | Type | Default | Description |
---|---|---|---|
title | string | {page_name}Â -Â pglet | A title of browser window. |
verticalFill | bool | false | Defines whether page contents takes 100% of the height of browser window. |
horizontalAlign | string | start | Defines how to align page children horizontally: start , end , center , space-between , space-around , space-evenly , baseline or stretch . |
verticalAlign | string | Defines how to align page children vertically: start , end , center , space-between , space-around , space-evenly , baseline or stretch . | |
width | string | 100% | The width of a page container. |
padding | string | 10px | The padding of a page container. |
gap | string | 10 | A gap between page child controls. |
Examples
- Python
- Bash
- PowerShell
- Node.js
Creating a new page with a random name and connecting to it:
import pglet
page = pglet.page()
Create a new app with name app1
and wait for connections. web=True
makes app UI displaying at Pglet service.
main
function is an entry point for a new user session. When a new user connects we just greem them with Hello, world!
message:
def main(page):
page.add(Text(value="Hello, world!"))
pglet.app("app1", web=True, target=main)
To update page title:
page.update(Page(title="My App!"))
# TODO
# TODO
// TODO