termui/_examples/hello_world.go

30 lines
453 B
Go
Raw Permalink Normal View History

2019-01-23 21:12:10 -07:00
// +build ignore
2018-11-29 16:51:43 -07:00
package main
2019-01-23 21:12:10 -07:00
import (
"log"
ui "git.tebitea.media/sashakoshka/termui/v3"
"git.tebitea.media/sashakoshka/termui/v3/widgets"
2019-01-23 21:12:10 -07:00
)
2018-11-29 16:51:43 -07:00
func main() {
2019-01-23 21:12:10 -07:00
if err := ui.Init(); err != nil {
log.Fatalf("failed to initialize termui: %v", err)
2018-11-29 16:51:43 -07:00
}
defer ui.Close()
2019-01-23 21:12:10 -07:00
p := widgets.NewParagraph()
p.Text = "Hello World!"
p.SetRect(0, 0, 25, 5)
2018-11-29 16:51:43 -07:00
ui.Render(p)
for e := range ui.PollEvents() {
if e.Type == ui.KeyboardEvent {
break
}
}
}