我是靠谱客的博主 火星上乌冬面,这篇文章主要介绍关于Easygui中Msgbox()函数的改良(超时(Timeout参数)自动关闭弹窗),现在分享给大家,希望可以做个参考。

原创不易

主要运用了threading,time和easygui

接下来看代码吧

import time
from threading import Thread
from easygui import buttonbox
def msgbox(msg="(Your message goes here)", title=" ",ok_button="OK",image=None,root=None,run=True,timeout=None):
    result=buttonbox(msg=msg,title=title,choices=[ok_button],image=image,default_choice=ok_button,cancel_choice=ok_button,run=run)
    if run or not(timeout):
        print(1)
        return result
    else:
        def Timer():
            time.sleep(timeout)
            result.stop()
        Thread(target=Timer).start()
msgbox(run=False,timeout=10)

最后

以上就是火星上乌冬面最近收集整理的关于关于Easygui中Msgbox()函数的改良(超时(Timeout参数)自动关闭弹窗)的全部内容,更多相关关于Easygui中Msgbox()函数内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(158)

评论列表共有 0 条评论

立即
投稿
返回
顶部