我已经成功使用guizero创建了欢迎文本,滑块和文本。但是,在移动滑块时,似乎无法更新文本。如果我将text命令放入变量change命令中,它会像应有的那样循环,但是它将打印应用程序,而不是就地更新。如果我将文本命令放在变量更改命令之外,则它在启动时仅打印一次。我该如何解决此问题。这是我的代码:
#Gui Speaker Output guispeak.py
import time
from guizero import App
from guizero import App, Text, PushButton, Slider
import RPi.GPIO as GPIO
freq = 0
app = App(title="Gui Speaker Output") ###########
################Add widgets in here##############
welcome_message = Text(app, text="This app is for producing a frequency through GPIO18", size=16, font="Times New Roman", color="blue")
def varchange(slider_value):
freq = str(slider_value)
Text(app, text=freq)
freqchange = Slider(app, command=varchange, start=0, end=20)
Text(app, text=freq)
#################################################
app.display() ###################################
#while True:
此外,如果您推荐更好的GUI库,请告诉我!