Update readme; add hello_world.go

This commit is contained in:
Caleb Bassi 2018-11-29 15:51:43 -08:00
parent ed219e8c05
commit b509ce1141
2 changed files with 24 additions and 4 deletions

View File

@ -37,11 +37,9 @@ func main() {
p.Height = 5
ui.Render(p)
uiEvents := ui.PollEvents()
for {
e := <-uiEvents
for e := range ui.PollEvents() {
if e.Type == ui.KeyboardEvent {
return
break
}
}
}

22
_examples/hello_world.go Normal file
View File

@ -0,0 +1,22 @@
package main
import ui "github.com/gizak/termui"
func main() {
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
p := ui.NewParagraph("Hello World!")
p.Width = 25
p.Height = 5
ui.Render(p)
for e := range ui.PollEvents() {
if e.Type == ui.KeyboardEvent {
break
}
}
}