termui/_examples/hello_world.go

30 lines
421 B
Go
Raw Normal View History

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