termui/_examples/list.go
Caleb Bassi b227bd5277 Rework event system
* Timers should now be done through Go tickers
* Reworked event names used in Handle()
* Reworked Event type and payloads
2018-09-06 16:43:11 -07:00

41 lines
764 B
Go

// Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can
// be found in the LICENSE file.
// +build ignore
package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
defer ui.Close()
strs := []string{
"[0] github.com/gizak/termui",
"[1] [你好,世界](fg-blue)",
"[2] [こんにちは世界](fg-red)",
"[3] [color output](fg-white,bg-green)",
"[4] output.go",
"[5] random_out.go",
"[6] dashboard.go",
"[7] nsf/termbox-go"}
ls := ui.NewList()
ls.Items = strs
ls.ItemFgColor = ui.ColorYellow
ls.BorderLabel = "List"
ls.Height = 7
ls.Width = 25
ls.Y = 0
ui.Render(ls)
ui.Handle("q", func(ui.Event) {
ui.StopLoop()
})
ui.Loop()
}