python - wxPython - 检测无输入变化的最佳方法?
问题描述
我有一个带有 wxPython 的 GUI,用于管理我的 SQL 查询的输入。我需要检查是否有任何输入(TextCtrl、ComboBox 等)被更改。
最好的方法是什么?我真的需要将所有输入保存在任何地方吗?
很抱歉没有提供代码,但我认为发布一个小的 wxPython 工具不会支持我的问题。
解决方案
试试这个 //sw
注意:我不知道 wxPython 是如何工作的,只有 pygame 和 tkinter
有一个空闲函数来检查_thread
import _thread
def this_function_should_return_the_text_of_the_inputbox():
return content_of_the_inputbox
def this_function_will_be_called_if_the_inputbox_is_changed():
Do something
def idle_checking():
latest_check = this_function_should_return_the_text_of_the_inputbox()
while True:
check = this_function_should_return_the_text_of_the_inputbox()
if latest_check != check:
latest_check = check
this_function_will_be_called_if_the_inputbox_is_changed()
_thread.start_new_thread(idle_checking,())
推荐阅读
- c++ - 类与结构的 C++ 效率
- ios - Swift pod 依赖 Firebase,pod spec lint 错误
- laravel - 如何将 nanoid 包从 npm 导入 Laravel?
- html - 具有最大列数的 CSS Grid 具有动态子项
- node.js - 打字稿覆盖 .env 文件设置
- ruby-on-rails - 无法将未经许可的参数转换为哈希
- node.js - api 调用受到另一个 api 调用验证的影响
- http - okhttp 发送错误 HTTP 消息,多个请求标头?
- python - 如何在python中将XML文件转换为PDF
- scala - scala spark job在失败时给出了奇怪的异常