03 2014 档案
摘要:写在属于自己的体会,哪怕只是一点点,也是真的懂了。否则有那么多书,如果只是不过脑子的学一遍看一遍,又有谁真的掌握了这些知识呢? 这样你或许就明白了为什么不能直接用SendMessage和PostMessage发送WM_PAINT的原因:由于没有invalidate,系统认为窗口没有更新的必要,于是就
阅读全文
摘要:import wxclass MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None) self.panel = wx.Panel(self) # create contr...
阅读全文
摘要:import wximport randomclass View(wx.Panel): def __init__(self, parent): super(View, self).__init__(parent) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.Bind(wx.EVT_PAINT, self.on_paint) self.Bind(wx.EVT_SIZE, self.on_size) def on_size(self, event): # OnSize时重画很棒...
阅读全文
摘要:import wxclass View(wx.Panel): def __init__(self, parent): super(View, self).__init__(parent) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_PAINT, self.on_paint) def on_size(self, event): # 没有这个事件,改变尺寸的时候就全乱了 ...
阅读全文
摘要: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) ...
阅读全文
摘要:代码摘自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的
阅读全文
摘要: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
阅读全文
摘要: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码是不行的),会导致解码错...
阅读全文
摘要: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 = [] ...
阅读全文
摘要:#!/usr/bin/env pythonimport wxclass DoubleEventFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Frame With Button', size=(300, 100)) self.panel = wx.Panel(self, -1) self.cc = 1 self.button = wx.Button(self.panel, -1, "Cli...
阅读全文
摘要:procedure TForm1.FormCreate(Sender: TObject);begin Graph:=TBitmap.Create; // On crée une variable de type TBitmap Graph.LoadFromFile('dessin.bmp'); ...
阅读全文
摘要:// DLL源代码 circle.dproj library circle; uses SysUtils, Classes, Math; {$R *.res} function CircleArea(const radius : double) : double; stdcall;begin res
阅读全文