termui/_examples/hello_world.go

30 lines
421 B
Go
Raw 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 "github.com/gizak/termui"
"github.com/gizak/termui/widgets"
)
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
}
}
}