gpt4 book ai didi

go - termui 的 termui.Handle ("/timer/1s",func(e termui.Event)) 在 ubuntu 18.04 上不工作

转载 作者:数据小太阳 更新时间:2023-10-29 03:21:27 24 4
gpt4 key购买 nike

我正在使用 golang 并出于某种目的使用了 termui 库。查找引用 here对于图书馆。

termui.Handle("/timer/1s", func(e termui.Event) {
if true {
if true {
strs = []string{"something"}
} else {
strs = []string{"something else"}
}
ls.Items = strs // ls := termui.NewList()
} else {
strs = []string{"something else"}
ls.Items = strs
}
termui.Render(ls)
})

上面的代码是假设在终端窗口上写了一个文本,但什么也没有发生。我没有关于相同的任何引用或解决方案。上面的代码适用于 Windows,但不适用于 ubuntu 18.04。

还有

termui.Handle("/sys/kbd/C-c", func(termui.Event) {
termui.StopLoop()
})

以上代码适用于 Windows 但不适用于 ubuntu 18.04。

请提供上述解决方案或替代方案。

提前致谢。

最佳答案

我在这里回答我自己的问题。图书馆的所有者改变他们的事件和功能。他们弃用了 /timer/1s 并强制用户使用 Go 内置计时器。 here是图书馆的变化和documentation

关于go - termui 的 termui.Handle ("/timer/1s",func(e termui.Event)) 在 ubuntu 18.04 上不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53117653/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com