Strange behavior due to wx.Frame.SetTitle

Posted by Anurag Uniyal on Stack Overflow See other posts from Stack Overflow or by Anurag Uniyal
Published on 2010-02-25T11:31:14Z Indexed on 2010/04/08 4:13 UTC
Read the original article Hit count: 464

In a wxPython application, which i am porting to Mac OSX, I set title of app frame every 500msec in update UI event, and due to that all the panels and windows are refreshed. That seems strange to me and almost halts my application which has many custom drawn controls and screens.

I wanted to know what could be the reason behind it, is it normal for MAC?

Here is a self-constrained script which replicates the scenario using timers. It keeps on printing "on paint" every 500ms because in timer I set title every 500ms.

import wx

app = wx.PySimpleApp()
frame = wx.Frame(None, title="BasePainter Test")
painter = wx.Panel(frame)

def onPaint(event):
    dc = wx.PaintDC(painter)
    print "onPaint"

painter.Bind(wx.EVT_PAINT, onPaint)

def loop():
    frame.SetTitle(frame.GetTitle())
    wx.CallLater(500, loop)
loop()

frame.Show(True)
app.SetTopWindow(frame)
app.MainLoop()

My system details:

>>> sys.version
'2.5 (r25:51918, Sep 19 2006, 08:49:13) \n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]'
>>> wx.VERSION
(2, 8, 10, 1, '')
>>> os.uname()
('Darwin', 'agyeys-mac-mini.local', '9.8.0', 'Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386', 'i386')

© Stack Overflow or respective owner

Related posts about wxpython

Related posts about macosx