在继续之前先打开kivy弹出窗口 [英] Open kivy popup before continuing

查看:106
本文介绍了在继续之前先打开kivy弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的方法中的其余代码完成运行之前,我的kivy弹出窗口不会出现在屏幕上.我正在尝试显示进度条,因此在当前状态下它毫无用处.

My kivy popup does not appear on the screen until the rest of the code in my method finishes running. I am trying to display a progress bar so it is worthless in it's current state.

我尝试将进程打开后弹出窗口,并尝试不使用线程.

I have tried to thread the process to open the popup and tried without threading.

from kivy.uix.progressbar import ProgressBar
from kivy.uix.popup import Popup
import threading

def submit():
    popup = Popup(title='Submit Progress', content=ProgressBar())
    thread_object = threading.Thread(target=popup.open)
    thread_object.start()
    perform some iterable actions 
       increment progress bar value

    if progress_bar.value == progress_bar.max:
        popup.auto_dismiss = True
        # This is when the popup finally appears

我需要弹出窗口的打开功能才能真正生效,然后再执行可迭代的操作,以便用户可以观察进度

I need the open function of my popup to actually take effect before performing the iterable actions so the user can watch the progress

推荐答案

我通过使用Clock.schedule_once()函数安排其他线程更新来解决了该问题.

I solved the issue by using the Clock.schedule_once() function to schedule my other threaded updates.

这篇关于在继续之前先打开kivy弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆