package main import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) func main() { app := tview.NewApplication() app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { if event.Rune() == 'q' { app.Stop() } return event }) shortcuts := tview.NewList(). AddItem("Run", "Press to run", 'r', nil). AddItem("New", "Press for new init", 'n', nil). AddItem("Quit", "Press to exit", 'q', func() { app.Stop() }). SetSelectedFocusOnly(true) main := tview.NewTextView(). SetTextAlign(tview.AlignCenter). SetText(GetText()) grid := tview.NewGrid(). SetRows(0). SetColumns(0, 30). AddItem(main, 0, 0, 1, 1, 0, 0, false). AddItem(shortcuts, 0, 1, 1, 1, 0, 0, true) grid.Box = tview.NewBox(). SetTitle("Game of Life"). SetBorder(true). SetBorderColor(tcell.ColorPurple) if err := app.SetRoot(grid, true).EnableMouse(true).Run(); err != nil { panic(err) } }