import wxclass Example(wx.Frame): def __init__(self, parent, title): super(Example, self).__init__(parent, title=title, size=(250, 150)) wx.FutureCall(2000, self.DrawLine) self.Centre() self.Show() def DrawLine(self): dc = wx.ClientDC(self) ... Read More
posted @ 2014-03-26 05:25 findumars Views(490) Comments(0) Diggs(0)
代码摘自wx\lib\agw\knobctrl.py一点体会是,OnSize作为class的函数,被放在构造函数里执行,会先于OnPaint执行。测试结果是,初始启动后,会执行8次OnSize(为什么是8次?2个闹钟就2次,每个闹钟分别1次SetTags,其中一个调用一次self.OnTicks,总共应该是5次),然后才会执行2次OnPaint。而且这两次OnPaint可能还是附送的,估计是执行的时候正好console盖住gui,gui恢复显示的时候会执行两次OnPaint用任意窗口遮住OnPaint,然后最小化,就会发现执行两次OnPaint(为什么是两次?一次就够了啊)每次OnPaint的 Read More
posted @ 2014-03-24 08:22 findumars Views(1622) Comments(0) Diggs(0)
UTF-8 不需要 BOM,尽管 Unicode 标准允许在 UTF-8 中使用 BOM。所以不含 BOM 的 UTF-8 才是标准形式,在 UTF-8 文件中放置 BOM 主要是微软的习惯(顺便提一下:把带有 BOM 的小端序 UTF-16 称作「Unicode」而又不详细说明,这也是微软的习惯)。BOM(byte order mark)是为 UTF-16 和 UTF-32 准备的,用于标记字节序(byte order)。微软在 UTF-8 中使用 BOM 是因为这样可以把 UTF-8 和 ASCII 等编码明确区分开,但这样的文件在 Windows 之外的操作系统里会带来问题。「UTF-8 Read More
posted @ 2014-03-24 06:33 findumars Views(46572) Comments(9) Diggs(10)
1. The complete Python source file should use a single encoding. Embedding of differently encoded data is not allowed and will result in a decoding error during compilation of the Python source code. Python源文件应该使用单一编码,嵌入不同编码的数据是不允许的(个人猜测:比如单一文件里一部分使用GBK,一部分使用BIG码是不行的),会导致解码错... Read More
posted @ 2014-03-24 06:11 findumars Views(2904) Comments(0) Diggs(0)
import wxclass SketchWindow(wx.Window): def __init__(self, parent, ID): wx.Window.__init__(self, parent, ID) self.SetBackgroundColour("White") self.color = "Black" self.thickness = 1 self.pen = wx.Pen(self.color, self.thickness, wx.SOLID) self.lines = [] ... Read More
posted @ 2014-03-23 07:51 findumars Views(1037) Comments(0) Diggs(0)