1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-24 13:48:56 +08:00

make textview1 example sleep when inactive

This commit is contained in:
ajcarvajal 2019-06-29 18:03:04 -08:00
parent 2e907d29e4
commit 49350e374a

View File

@ -45,9 +45,13 @@ func TextView1(nextSlide func()) (title string, content tview.Primitive) {
go func() {
var n int
for {
n++
fmt.Fprintf(textView, "%d ", n)
time.Sleep(200 * time.Millisecond)
if textView.HasFocus() {
n++
fmt.Fprintf(textView, "%d ", n)
time.Sleep(200 * time.Millisecond)
} else {
time.Sleep(time.Second)
}
}
}()
textView.SetBorder(true).SetTitle("TextView implements io.Writer")