ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
RE: [wxpython-users] A newbie question about wx.PaintEvent
by Marlin Rowley other posts by this author
May 10 2008 9:53AM messages near this date
Re: [wxpython-users] A newbie question about wx.PaintEvent | [wxpython-users] Grid layouting problem
OnPaint needs a device context created which binds the frame class and the device together. 
 If this isn't present, the OnPaint() function gets stuck in an infinite loop and never retu
rns control to the frame.  You must create a device context to draw on within each paint eve
nt function.
 
-M


From: ilovepython1978@hotmail.comTo: wxpython-users@lists.wxwidgets.orgDate: Sat, 10 May 200
8 22:28:50 +0800Subject: [wxpython-users] A newbie question about wx.PaintEvent


Hi, all.when I run the following codes, the result is not what I expected:------------------
-------------------------------------------import wxclass PaintEventFrame(wx.Frame):    def 
__init__(self,parent,id,title):        wx.Frame.__init__(self,parent,id,title)        self.p
anel=wx.Panel(self,-1)                self.count=0                self.panel.Bind(wx.EVT_PAI
NT,self.OnPaint)                self.Center()        self.Show(True)        def OnPaint(self
,event):        self.count=self.count+1  &nbs p;     print self.countif __name__=="__main__"
:    app=wx.App(False)    PaintEventFrame(None,-1,"PaintEvent Frame")    app.MainLoop()-----
---------------------------------------------------------------The printed result is increme
ntd from 1 to larger numbers continuously, why?But if I palce "dc=wx.PaintDC(self.panel)" in
to the "OnPaint" method, the result is what I expected, why?Best regards!---I love Python!--
----ilovepython1978---

Windows Live Writerï¼?æ?¯æ?ç¦»çº¿æ?°å??å?客å??容ï¼?é?æ?¶é?å?°æ?³å??å°±å??ã?? ç«?即使
�! 
_________________________________________________________________
Get Free (PRODUCT) REDâ?¢  Emoticons, Winks and Display Pics.
http://joinred.spaces.live.com?ocid=TXT_HMTG_prodredemoticons_052008
Thread:
Gaobing
Robin Dunn
Marlin Rowley

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved