I am using the command dc.DrawText(str(n).zfill(4),20, bitmapHeight
+10) in my code to update the number on the screen. The number n is
increamented each time when the code is running. However, the display
is initially correct. then it becomes blurred and not readable. I do
not know how to fix it and hope to get advice from the group.
When text is drawn with anti-aliasing over the text that was there formally then the pixels that are partially transparent add to each other and eventually turn full black. You can deal with this by either first clearing or redrawing (if it's not a solid color) the area where the text will be and then drawing the text. Or you can use SetTextBackground(color) and SetBackgroundMode(wx.SOLID) and the DC will fill the text rectangle for you. Either of these will add to the flicker on Windows so you may want to consider double buffering if you are not already using it.
···
On 11/2/11 11:28 AM, yixiaodafang@gmail.com wrote:
Hi,
I am using the command dc.DrawText(str(n).zfill(4),20, bitmapHeight
+10) in my code to update the number on the screen. The number n is
increamented each time when the code is running. However, the display
is initially correct. then it becomes blurred and not readable. I do
not know how to fix it and hope to get advice from the group.
Thank you very much. That solved my problem. wxpython is a great and
interesting tool.
Frank
···
On Nov 2, 2:38 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 11/2/11 11:28 AM, yixiaodaf...@gmail.com wrote:
> Hi,
> I am using the command dc.DrawText(str(n).zfill(4),20, bitmapHeight
> +10) in my code to update the number on the screen. The number n is
> increamented each time when the code is running. However, the display
> is initially correct. then it becomes blurred and not readable. I do
> not know how to fix it and hope to get advice from the group.
When text is drawn with anti-aliasing over the text that was there
formally then the pixels that are partially transparent add to each
other and eventually turn full black. You can deal with this by either
first clearing or redrawing (if it's not a solid color) the area where
the text will be and then drawing the text. Or you can use
SetTextBackground(color) and SetBackgroundMode(wx.SOLID) and the DC will
fill the text rectangle for you. Either of these will add to the
flicker on Windows so you may want to consider double buffering if you
are not already using it.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
No. Freeze simply suspends the sending of paint events and Thaw allows them to be sent again, along with the equivalent of a Refresh after the Thaw. The content of the window will still be painted exactly the same way when that paint event is processed, and if on Windows and if the paint handler has multiple steps that could be individually visible to the user then there will be flicker.
···
On 11/3/11 7:47 AM, Dev Player wrote:
Is Freeze() and Thaw() and an alternative to double buffering?