I am making a KIVY program in python and have a time.sleep(3) in my code so that it waits three seconds before changing the screen.
(我正在用python创建一个KIVY程序,并且在我的代码中有一个time.sleep(3),以便它在更改屏幕之前等待三秒钟。)
But the function above it works after the 3 seconds and not before it. (但是它上方的功能会在3秒钟后而不是之前起作用。)
I am having no errors and I have tried everything but nothing seems to work. (我没有错误,我已经尝试了一切,但似乎没有任何效果。)
Here is the snippet. (这是代码段。)
def input_button(self, instance): # creating the button that when pressed updates the label
query = "You Said {}".format(self.command()) # making the query
if query == "You Said None":
self.update_info('Please input a command')
else:
self.update_info(query) # updating the label
time.sleep(3)
pa_app.screen_manager.current = "Result"
The self.update_info(query) runs after three seconds but the time.sleep is after it.
(self.update_info(query)在三秒钟后运行,但是time.sleep在它之后。)
ask by Apurv Pandey translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…