termui [11.6k]

最后更新于:2022-04-02 02:38:57

[TOC] > [参考](https://github.com/gizak/termui/) ## 概述 * [BarChart](https://github.com/gizak/termui/blob/master/_examples/barchart.go) * [Canvas](https://github.com/gizak/termui/blob/master/_examples/canvas.go)(for drawing braille dots) * [Gauge](https://github.com/gizak/termui/blob/master/_examples/gauge.go) * [Image](https://github.com/gizak/termui/blob/master/_examples/image.go) * [List](https://github.com/gizak/termui/blob/master/_examples/list.go) * [Tree](https://github.com/gizak/termui/blob/master/_examples/tree.go) * [Paragraph](https://github.com/gizak/termui/blob/master/_examples/paragraph.go) * [PieChart](https://github.com/gizak/termui/blob/master/_examples/piechart.go) * [Plot](https://github.com/gizak/termui/blob/master/_examples/plot.go)(for scatterplots and linecharts) * [Sparkline](https://github.com/gizak/termui/blob/master/_examples/sparkline.go) * [StackedBarChart](https://github.com/gizak/termui/blob/master/_examples/stacked_barchart.go) * [Table](https://github.com/gizak/termui/blob/master/_examples/table.go) * [Tabs](https://github.com/gizak/termui/blob/master/_examples/tabs.go) * ![](https://github.com/gizak/termui/raw/master/_assets/demo.gif) ## 示例 ### hello word ``` package main import ( "log" ui "github.com/gizak/termui/v3" "github.com/gizak/termui/v3/widgets" ) func main() { if err := ui.Init(); err != nil { log.Fatalf("failed to initialize termui: %v", err) } defer ui.Close() p := widgets.NewParagraph() p.Text = "Hello World!" p.SetRect(0, 0, 25, 5) ui.Render(p) for e := range ui.PollEvents() { if e.Type == ui.KeyboardEvent { break } } } ```
';