Introduction
What is Pglet​
Pglet is a rich user interface (UI) framework for scripts and programs written in any language and a service for securely sharing your application UI. Python, Bash, PowerShell and Node.js are already supported and other languages can be easily added via Pglet protocol.
Pglet renders web UI, so you can easily build web apps with your favorite language. Knowledge of HTML/CSS/JavaScript is not required as you build UI with controls. Pglet controls are built with Fluent UI React to ensure your programs look cool and professional.
Hello, world!​
- Python
- Bash
- PowerShell
- Node.js
Install pglet
module:
pip install pglet
Create hello.py
with the following contents:
import pglet
from pglet import Text
p = pglet.page()
p.add(Text("Hello, world!"))
Run hello.py
with Python 3 and in a new browser window you'll get:
Here is a local page served by an instance of Pglet server started in the background on your computer.
Now let's bring that page to a web, so others can see it!
Add web=True
to pglet.page
call:
p = pglet.page(web=True)
p.add(Text("Hello, world!"))
Download script with helper Pglet functions:
curl -O https://pglet.io/pglet.sh
Create hello.sh
with the following contents:
. pglet.sh
pglet_page
pglet_add "text value='Hello, world!'"
Run sh hello.sh
and in a new browser window you'll get:
Here is a local page served by an instance of Pglet server started in the background on your computer.
Now let's bring that page to a web, so others can see it!
Add PGLET_WEB=true
before pglet_page
call:
PGLET_WEB=true pglet_page
pglet_add "text value='Hello, world!'"
Install pglet
module:
Install-Module pglet
Create hello.ps1
with the following contents:
Import-Module pglet
$page = Connect-PgletPage
$page.add((Text 'Hello, world!'))
Run hello.ps1
in a PowerShell session and in a new browser window you'll get:
Here is a local page served by an instance of Pglet server started in the background on your computer.
Now let's bring that page to a web, so others can see it!
Add -Web
parameter to Connect-PgletPage
call:
$page = Connect-PgletPage -Web
$page.add((Text 'Hello, world!'))
Install pglet
module:
npm install pglet
Create hello.js
with the following contents:
const pglet = require("pglet");
(async () => {
let p = await pglet.page();
await p.send("add text value='Hello, world!'");
})();
Run node hello.js
and in a new browser window you'll get:
Here is a local page served by an instance of Pglet server started in the background on your computer.
Now let's bring that page to a web, so others can see it!
Add { web: true }
option to pglet.page
call:
let p = await pglet.page({ web: true });
await p.send("add text value='Hello, world!'");
This time the page will be created on Pglet hosted service.
Tutorials​
Want to learn how to build the real app? Jump to a tutorial for your language: