How to clear the screen of glitched rectangles? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to clear the screen of glitched rectangles? (/thread-2272.html) |
How to clear the screen of glitched rectangles? - user294869 - Mar-03-2017 I'm coding a program that captures a section of the screen as an image by drawing a rectangle with cursor, yet the process creates glitched rectangles. Is there a way to refresh the screen or maybe a completely different code that works? The dc.Clear() doesn't seem to clear the screen. import wx import win32gui app = wx.PySimpleApp() dc = wx.ScreenDC() dc.StartDrawingOnTop(None) dc.SetPen(wx.Pen('red', 2)) dc.SetBrush(wx.TRANSPARENT_BRUSH) int_x = win32gui.GetCursorPos()[0] int_y = win32gui.GetCursorPos()[1] while 1: dc.DrawRectangle(int_x,int_y,win32gui.GetCursorPos()[0]-int_x,win32gui.GetCursorPos()[1]-int_y) dc.Clear() RE: How to clear the screen of glitched rectangles? - Larz60+ - Mar-03-2017 The dc.clear() which should work but it's part of an endless while loop. The 'jaggard' rectangles is is because the rectangle is constantly being drawn, then erased and the cycle repeated.
|