wxPython - 带定时器的问题 [英] wxPython - problem w/ timers

查看:86
本文介绍了wxPython - 带定时器的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中出现以下错误:

I get the following error in my app:

展开 | 选择 | Wrap | 行号

推荐答案

我唯一的原因可以提出的是文档说:
The only reason that I can come up with is that the docs say:

注意:计时器只能在主线程中使用。
Note: A timer can only be used from the main thread.



我能想出的唯一理由是文档说:
The only reason that I can come up with is that the docs say:



显然没有那种情况,计时器只是不会开始。但是,我想过使用标准的Python线程计时器,我想知道它们是否可以安全地使用wxPython?

Apparently there''s no going around that, the timers just won''t start. However, I thought about using standard Python threading timers, I wonder if they''re safe to use with wxPython?



显然有'不管怎样,计时器就不会开始了。但是,我想过使用标准的Python线程计时器,我想知道它们是否可以安全地与wxPython一起使用?
Apparently there''s no going around that, the timers just won''t start. However, I thought about using standard Python threading timers, I wonder if they''re safe to use with wxPython?



雅知道;我一直在研究一个需要在缺少wx事件处理程序的模块中使用计时器的项目。 threading.Timer 是一个选项(绝对是线程安全的),但是你需要注意如何实现重复和停止它的能力。我还研究了 sched.scheduler ,它有很好地记录错误处理。我会进行线程测试,看看它是如何工作的。

Ya know; I''ve been working on a project that needed a timer in a module that lacked a wx event handler. threading.Timer is one option (definitely thread safe), but you''ll need to be careful as to how you implement the recurrence and the ability to stop it. I also looked into sched.scheduler which has nicely documented error handling. I''ll whip up a threaded test to see how that might work.


这篇关于wxPython - 带定时器的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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