feature: support table (#1)

This commit is contained in:
万昭祎
2016-11-10 18:55:42 +08:00
committed by GitHub
parent bfde399a8c
commit 25c85a59b0
3 changed files with 135 additions and 0 deletions

34
_example/table.go Normal file
View File

@@ -0,0 +1,34 @@
package main
import "termui"
func main() {
err := termui.Init()
if err != nil {
panic(err)
}
defer termui.Close()
rows := [][]string{
[]string{"header1", "header2", "header3"},
[]string{"I love Veronica", "Go-lang is so cool", "Im working on Ruby"},
[]string{"2016", "11", "11"},
}
table := termui.NewTable()
table.Rows = rows
table.FgColor = termui.ColorWhite
table.BgColor = termui.ColorDefault
table.TextAlign = "center"
table.Analysis()
table.SetSize()
table.Y = 0
table.X = 0
table.Border = true
termui.Render(table)
termui.Handle("/sys/kbd/q", func(termui.Event) {
termui.StopLoop()
})
termui.Loop()
}

BIN
_example/table.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB