【发布时间】:2019-07-11 13:34:18
【问题描述】:
我想用进度条制作时间计数器。进度条应该随着时间的推移而填充。
我已经按照下面代码中的逻辑进行了处理,但是代码在程序打开之前就开始了。
酒吧应该每秒都被塞满。至少我是这么认为的。
'''
def update_time(self):
while self.ids.pb.value < 30:
time.sleep(1)
self.ids.pb.value+=1
'''
相关的.kv文件。
'''
<Question>:
name:"questions"
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: 'bg2.jpg'
FloatLayout:
Label:
id:quest
pos_hint: {"x":0.1,"y":0.62}
size_hint: 0.7,0.5
text:root.sendquest()
color:1, 0, 0, 1
ProgressBar:
id : pb
min :0
max :30
pos_hint: {'x': 0.1,"y":0.45}
size_hint_x :0.8
size_hint_y :0.03
background_color:0.8, 0.1, 0.1, 0
Button: #A
id:A
pos_hint: {"x":0.045,"y":0.376}
size_hint: 0.91,0.055
on_press:
root.reset() if root.check_truth("A") else root.popup()
'''
main.py 文件中有与本主题无关的函数。
【问题讨论】:
标签: kivy