An UNIX-philosophy utility for standing up GUIs.
Warning
Not working yet, under development. The Tk programs producing the screenshots
below have been hand-made, not produced by the gui utility. We're getting
there!
- Tcl/Tk 9
- macOS:
brew install tcl-tk - Linux:
apt install tk
- macOS:
The language is roughly similar to HTML: each element can contain attributes, an ID and a value.
Strings are specified in double quotes:
"Hello World"
"Multi\nline"
"With \"quotes\""
Integers are specified as numbers:
123
0
Elements can be specified in several ways:
divider # Basic element
button#title # Button with ID
label:"Hello World" # Label with text
button(fgcolor:"red") # Button with red text
label#title(fgcolor:"red"):"Hello World" # Full label with ID, color and text
Attributes are specified in parentheses after the element name, separated by a comma.
input(placeholder:"Enter text")
button(onclick:#name->STDOUT)
label(fgcolor:"red",onclick:"doSomething")
IDs are specified with a hash (#) after the element name:
input#username
button#submit
Lists are specified in square brackets with comma-separated elements:
col:[label:"Hello", input:"World"]
row:[button:"OK", button:"Cancel"]
There are special objects for I/O operations:
STDIN- Reads from standard inputSTDOUT- Writes to standard outputSTDERR- Writes to standard errorFILE(path/to/file.txt)- Reads from or writes to a file
Functions say which source should be sent to which destination, using the arrow
syntax (->):
#name->STDOUT # Send value of #name to STDOUT
"xyz"->#button # Send the string to be the #button text
#textarea->FILE(x.txt) # Write the contents of #textarea to a file
"Bleh"->STDERR # Send the string to STDERR
Currently supported elements include:
label- Displays textinput- Single-line text inputtextarea- Multi-line text inputbutton- Clickable buttoncol- Vertical containerrow- Horizontal container
Examples:
label:"Static text"
input(placeholder:"Type here")
textarea:STDIN
button(onclick:#name->STDOUT):"Click me"
col:[label:"Name:", input#name]
row(gap:5):[button:"OK", button:"Cancel"]
- JSON mode:
{
"col": [
{ "label": "Your name:" },
{ "input#name": null },
{ "button": { "onclick": "#name->STDOUT", "value": "Submit" } }
]
}- json expando tree view
- example of a wizard dialog
- example of plucking just some values from JSON
- document supported attributes and examples
- what about appending to a file?
- what about negative numbers




