摘要: wx.CallAfter takes 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.切换行号显示import threading,wxID_RUN=101ID_RUN2=102class MyFrame(wx.Frame): ... 阅读全文
posted @ 2013-09-05 23:24 dengyigod 阅读(343) 评论(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-09-05 23:20 dengyigod 阅读(387) 评论(0) 推荐(0) 编辑
摘要: Non-blocking GUIThis article is intended to give a simple overview (initially anyway) about how to write a program with a non-blocking GUI in wxPython. This topic seems to present difficulty to people on a regular basis as it is often brought up on mailing list. So hopefully through the information 阅读全文
posted @ 2013-09-05 23:18 dengyigod 阅读(258) 评论(0) 推荐(0) 编辑
摘要: IntroductionWe'll need a threading recipe, this is the old Mandelbrot frame a number of us were working on way back when. Not really heavily threaded, but only thing I have that uses normal threads (not micro-threads).See alsoLongRunningTasks,MainLoopAsThread.Example切换行号显示#! /usr/bin/env python# 阅读全文
posted @ 2013-09-05 23:15 dengyigod 阅读(341) 评论(0) 推荐(0) 编辑
摘要: Last year I needed to figure out a way to get the following information with Python: get the route table, capture the data from pinging a series of IPs, run tracert and get information about the NIC(s) installed. This all needed to be done on a Windows machine as it was part of a diagnostics script 阅读全文
posted @ 2013-09-05 23:14 dengyigod 阅读(856) 评论(0) 推荐(0) 编辑
摘要: If you use GUIs in Python much, then you know that sometimes you need to execute some long running process every now and then. Of course, if you do that as you would with a command line program, then you’ll be in for a surprise. In most cases, you’ll end up blocking your GUI’s event loop and the use 阅读全文
posted @ 2013-09-05 23:12 dengyigod 阅读(604) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/envpython2#-*-coding:UTF-8-*-34#构建节点5classNode:6def__init__(self):7self.map={}8defcontain(self,key):9returnself.map.__contains__(key)10def__getitem__(self,key):11returnself.map[key]12def__setitem__(self,key,value):13self.map[key]=value1415classItem:16def__init__(self,key):17self.key=key18 阅读全文
posted @ 2013-07-09 01:19 dengyigod 阅读(1107) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(265) 评论(0) 推荐(0) 编辑