Closed arxdsilva closed 7 years ago
Before resizing: after:
source code:
package main import "github.com/gizak/termui" const height = 11 func main() { err := termui.Init() if err != nil { panic(err) } defer termui.Close() termui.Handle("/sys/kbd/q", func(termui.Event) { termui.StopLoop() }) rows1 := [][]string{ []string{"#", "app-list"}, []string{"1", "tsuru"}, []string{"2", "globoplay"}, []string{"3", "ge"}, []string{"4", "neymar"}, } par1 := termui.NewPar("arthur.silva@corp.globo.com") par1.Height = 3 par1.BorderLabel = "user" rows0 := [][]string{ []string{"target", "set"}, []string{"dev", "*"}, []string{"qa", ""}, []string{"qa02", ""}, []string{"prod", ""}, } table0 := termui.NewTable() table0.Rows = rows0 table0.FgColor = termui.ColorWhite table0.BgColor = termui.ColorDefault table0.Height = height table1 := termui.NewTable() table1.Rows = rows1 table1.FgColor = termui.ColorWhite table1.BgColor = termui.ColorDefault table1.Width = 20 table1.Height = height bc := termui.NewBarChart() data := []int{5, 12, 25, 7} bclabels := []string{"#1", "#2", "#3", "#4"} bc.BorderLabel = "Units" bc.Data = data bc.Height = height bc.DataLabels = bclabels bc.TextColor = termui.ColorGreen bc.BarColor = termui.ColorRed bc.NumColor = termui.ColorYellow termui.Body.AddRows( termui.NewRow( termui.NewCol(3, 0, par1), termui.NewCol(3, 0, table0), termui.NewCol(3, 0, table1), termui.NewCol(3, 0, bc), ), ) termui.Body.Align() termui.Render(table1, par1, bc, table0) termui.Loop() }
Did you try _example/grid.go? Is it working on your terminal?
_example/grid.go
Well, turns out that I've forgotten to add the handler :), btw after doing It I still got some visual bug:
Before resizing: after:
source code: