Failing to update pygame surfaces
<p>I'm making a pygame game. I have 3 surfaces: <code>gameDisplay</code> (where the character and background is directly rendered to), <code>guiSurf</code> and <code>invSurf</code>
I have a clock made in core pyhon which displays the game time with the pygame font. I blit the clock to <code>guiSurf</code> and then in my gameloop I blit <code>guiSurf</code> and <code>invSurf</code> to <code>gameDisplay</code>. My problem is that the clock leaves a mark from where it was. IE when it changes from '07:00' to '07:01', the '01' is ontop of the '00' which shouldn't be there. I would post the code but theres like 400 lines. Does anyone have any idea what I may of done wrong. <a href="http://gyazo.com/5716aeda3a5769aac7af985db6907caa.png" rel="nofollow">Link to a picture of the clock</a></p>

<p>Make sure you 'clear' the area of where the time is being printed by blitting another image over the spot where the text is. When you draw your surfaces to the screen it simply becomes one 'surface' that is always drawn until overwritten by something else. You need to clear this surface before you blit something else to it, otherwise you get the effect you see. By simple calling display_name.fill((0,0,0)) at the beginning of every game tick you will 'clear' the screen and then redraw your text onto it without the spillover effect. Of course you will have to reblit everything to the screen every tick, but this should not be a problem unless you need to blit thousands of items. If you do not wish to redraw everything, then blit a small rectangle over the text and then redraw it, and your issues should be solved.</p>

<p>I hope this helps you with your issue and happy coding!</p>

python python-3.x pygame python-3.5 pygame-surface