termui/_example/list.go

45 lines
875 B
Go
Raw Normal View History

2016-01-27 09:45:18 +08:00
// Copyright 2016 Zack Guo <gizak@icloud.com>. All rights reserved.
2015-03-21 04:21:50 +08:00
// Use of this source code is governed by a MIT license that can
// be found in the LICENSE file.
// +build ignore
package main
import "github.com/gizak/termui"
func main() {
err := termui.Init()
if err != nil {
panic(err)
}
defer termui.Close()
2015-10-09 10:11:26 +08:00
//termui.UseTheme("helloworld")
strs := []string{
"[0] github.com/gizak/termui",
2015-10-09 10:11:26 +08:00
"[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 := termui.NewList()
ls.Items = strs
ls.ItemFgColor = termui.ColorYellow
2015-10-09 10:11:26 +08:00
ls.BorderLabel = "List"
ls.Height = 7
ls.Width = 25
ls.Y = 0
termui.Render(ls)
2015-10-09 10:11:26 +08:00
termui.Handle("/sys/kbd/q", func(termui.Event) {
termui.StopLoop()
})
termui.Loop()
}