[shi•rei] A new immediate-mode GUI framework for Go
judi.systems·4h·
Discuss: r/golang

Practical cross-platform immediate-mode GUI framework for Go


package main

import (
app "go.hasen.dev/shirei/giobackend"

. "go.hasen.dev/shirei"
. "go.hasen.dev/shirei/tw"
. "go.hasen.dev/shirei/widgets"
)

func main() {
app.SetupWindow("Small Demo", 400, 200)
app.Run(RootView)
}

var name string
var response = "Please give me your name"
var colorBG bool = true

func RootView() {
ModAttrs(Gap(10))
if colorBG {
ModAttrs(BG(220, 20, 90, 1))
}

Layout(TW(Pad(20), Gap(10)), func() {
Label("Name:", FontWeight(WeightBold))
Layout(TW(Row, CrossMid, Gap(10)), func() {
TextInput(&name)
if Button(SymInfo, "Hello") {
if name == "" {
response = "Uh, sorry who are you again?"
} else {
response = "Well, hello " + name + "!"
}
}
})
Label(response)
})

Layout(TW(Expand, Row, CrossMid, Pad2(10, ...

Similar Posts

Loading similar posts...