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:
parent
2e907d29e4
commit
49350e374a
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user