...
1 package main
2
3 import (
4 "github.com/gdamore/tcell/v2"
5 "github.com/rivo/tview"
6 )
7
8 const helloWorld = `[green]package[white] main
9
10 [green]import[white] (
11 [red]"github.com/rivo/tview"[white]
12 )
13
14 [green]func[white] [yellow]main[white]() {
15 box := tview.[yellow]NewBox[white]().
16 [yellow]SetBorder[white](true).
17 [yellow]SetTitle[white]([red]"Hello, world!"[white])
18 tview.[yellow]NewApplication[white]().
19 [yellow]SetRoot[white](box, true).
20 [yellow]Run[white]()
21 }`
22
23
24 func HelloWorld(nextSlide func()) (title string, content tview.Primitive) {
25
26 textView := tview.NewTextView().SetDoneFunc(func(key tcell.Key) {
27 nextSlide()
28 })
29 textView.SetBorder(true).SetTitle("Hello, world!")
30 return "Hello, world", Code(textView, 30, 10, helloWorld)
31 }
32
View as plain text