摘要: wxPython And TwistedThis was copied from wxPython-users as a starting point for using wxPython and Twisted together. Feel free to expand and adapt this document as you gain your own experience with wxPython and Twisted.David Bolen writes:Mike Driscoll writes:> I looked at Twisted one wxPython exa 阅读全文
posted @ 2013-05-22 23:59 dengyigod 阅读(340) 评论(0) 推荐(0) 编辑
摘要: Tip of the Day Recipe"Tip of the day" is easily implemented with thewxCreateFileTipProviderfunction and a text file full of tips.Your application will need:Some sort of persistence to remember whether tips are being shown and which tip will be shown next. For this recipe, I'm just refe 阅读全文
posted @ 2013-05-22 23:58 dengyigod 阅读(301) 评论(0) 推荐(0) 编辑
摘要: IntroductionThe following was posted to the comp.lang.python newsgroup on 24-May-2001. Since it explains very well the options for keeping the GUI responsive when the application has to do long running tasks I decided to copy it here verbatim. Many thanks toDavid Bolenfor taking the time and effort 阅读全文
posted @ 2013-05-22 23:57 dengyigod 阅读(263) 评论(0) 推荐(0) 编辑
摘要: IntroductionThe original bounty (whose content is farther down) required a scheduling widget for handling appointments in a medical doctor's office. This widget needed to support initially fixed time slots, dragging and dropping of appointments, etc.What Objects/Features are Involvedwx.gridwx.li 阅读全文
posted @ 2013-05-22 23:56 dengyigod 阅读(379) 评论(0) 推荐(0) 编辑
摘要: wx.CallAftertakes a function and its arguments, and calls the function when the current event handler has exited. It is a safe way of requesting action of a Window from another thread. The code below has a couple of examples.切换行号显示 1 import threading,wx 2 3 ID_RUN=101 4 ID_RUN2=102 5 6... 阅读全文
posted @ 2013-05-22 23:55 dengyigod 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 如果你经常使用python开发GUI程序的话,那么就知道,有时你需要很长时间来执行一个任务。当然,如果你使用命令行程序来做的话,你回非常惊讶。大部分情况下,这会堵塞GUI的事件循环,用户会看到程序卡死。如何才能避免这种情况呢?当然是利用线程或进程了!本文,我们将探索如何使用wxPython和theading模块来实现。wxpython线程安全方法wxPython中,有三个“线程安全”的函数。如果你在更新UI界面时,三个函数都不使用,那么你可能会遇到奇怪的问题。有时GUI也忙运行挺正常,有时却会无缘无故的崩溃。因此就需要这三个线程安全的函数:wx.PostEvent, wx.CallAfter和 阅读全文
posted @ 2013-05-22 23:45 dengyigod 阅读(977) 评论(0) 推荐(0) 编辑
摘要: 在GUI中进行多线程编程是一件很麻烦的事情,一直以来我都在寻找一个通用的方便的处理方法。在前一段时间中我曾经发表过关于长流程的处理,主要是在处理中插入一个对调度器的处理,而这个调度器使用了队列来实现子线程与主线程之间的数据通信。它的确可以解决一些问题,但并不是非常的方便。那么总结在wxPython中所提出的解决多线程问题的答案如下:不要在子线程中进行GUI的更新处理,所有的GUI的更新全部由GUI线程(主线程)来完成使用自定义事件来定义一个事件,然后就可以使用wxPostEvent来发送这个事件,这样会将这个事件放入主线程的事件循环中,从而使用事件得以安全的处理。使用线程安全的队列(Queue 阅读全文
posted @ 2013-05-22 23:44 dengyigod 阅读(538) 评论(0) 推荐(0) 编辑