Simple Immediate Mode Terminal UI
package main
import "github.com/ofabricio/imtui"
func main() {
tui := imtui.New()
var clicks int
for range tui.Loop() {
if tui.Button(" Click! ") {
clicks++
}
tui.Text(fmt.Sprintf(" Button clicked %d times ", clicks))
}
}This demo is from the example in example/demo.go.
for range tui.Loop() {
tui.Text("Hello, World!")
}var clicks int
for range tui.Loop() {
if tui.Button(" Click! ") {
clicks++
}
tui.Text(fmt.Sprintf(" Button clicked %d times ", clicks))
}var toggle bool
for range tui.Loop() {
if tui.Toggle(" Expand ", &toggle); toggle {
tui.Text(" Hello! ")
}
}var one, two bool
for range tui.Loop() {
tui.Check("One ", &one)
tui.Check("Two ", &two)
tui.Text(fmt.Sprintf(" One is %t; Two is %t ", one, two))
}var opt int = -1
for range tui.Loop() {
tui.Radio("One ", 0, &opt)
tui.Radio("Two ", 1, &opt)
tui.Text(fmt.Sprintf(" Item selected: %v ", opt))
}