Search code examples
pythonpython-2.7wxpythonstatic-text

Alternative to wxStaticText in wxPython?


I have a problem in which I update StaticText fairly often(once every second) and every time it updates, it tears the frame. This is very bothersome on Windows but on Linux it never happened. I tried doing TextCtrl Readonly but I get ugly boxes around text I was wondering if there was a better option for updating text in wxPython frequently that wouldn't tear the screen. Thanks in advance!


Solution

  • I wish I understood better what you meant by "tearing" the frame - I don't seem to have problems with changing StaticText values after a window is created (though sometimes it's necessary to call Layout on a Panel or Dialog).

    However, if you're really just looking for read-only TextCtrl's without the "ugly boxes" you should use TextCtrl(style = wx.NO_BORDER | wx.TE_READONLY). The combination will give you what you want - what appears to be a StaticText, but that can't be user-edited and doesn't display a border. You'll also be able to select its value (which may or may not be an advantage).