gpt4 book ai didi

python - 根据输入设置变量值,StringProperty kivy

转载 作者:太空宇宙 更新时间:2023-11-03 19:48:05 26 4
gpt4 key购买 nike

当我尝试根据输入更新值时,我遇到了 Kivy StringProperty 变量的问题。

让它变得简单一点,这样我也能理解(我对此有点陌生)。

TextTime1 = StringProperty()
TextTime2 = StringProperty()
x = 2

TextTime+x = "TEST"

我怎样才能让它发挥作用?

我已经尝试过

TextTime1 = StringProperty()
TextTime2 = StringProperty()
TextTimes = [TextTime1, TextTime2]
x = 2

TextTimes[x-1] = "TEST"

不起作用。唯一有效的是:

TextTime1 = StringProperty()
TextTime2 = StringProperty()

TextTime2 = "TEST"

如何获得更“动态”的工作方式?

最佳答案

据我了解,您正在尝试替换列表中的最后一个值?

你也许可以让它像这样工作

TextTime1 = StringProperty()
TextTime2 = StringProperty()

TextTimes = [TextTime1, TextTime2]

TextTimes.pop()
TextTimes.append("TEST")

关于python - 根据输入设置变量值,StringProperty kivy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60015628/

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