mirror of
https://github.com/rivo/tview.git
synced 2025-04-30 13:48:50 +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() {
|
go func() {
|
||||||
var n int
|
var n int
|
||||||
for {
|
for {
|
||||||
n++
|
if textView.HasFocus() {
|
||||||
fmt.Fprintf(textView, "%d ", n)
|
n++
|
||||||
time.Sleep(200 * time.Millisecond)
|
fmt.Fprintf(textView, "%d ", n)
|
||||||
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
} else {
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
textView.SetBorder(true).SetTitle("TextView implements io.Writer")
|
textView.SetBorder(true).SetTitle("TextView implements io.Writer")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user