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