Python Forum
How to clear the screen of glitched rectangles?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to clear the screen of glitched rectangles?
#1
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()
Reply


Messages In This Thread
How to clear the screen of glitched rectangles? - by user294869 - Mar-03-2017, 08:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  clear screen with pycharm boris602 0 2,190 Dec-12-2019, 12:28 PM
Last Post: boris602
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,192 Feb-06-2019, 01:25 AM
Last Post: woooee
  PyCharm Clear Screen Larry 4 19,135 Feb-22-2018, 12:18 AM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020