Created
June 15, 2017 13:31
-
-
Save BedirYilmaz/7ea0775660081110fba545bb878bb58a to your computer and use it in GitHub Desktop.
Open your Paint at fullscreen and let your code draw nested circles with your mouse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32api, win32con | |
import math | |
widest = 1000 | |
narrowest = 100 | |
step = 100 | |
num_of_points = 100 | |
def click(x, y): | |
#https://stackoverflow.com/questions/1181464/controlling-mouse-with-python | |
win32api.SetCursorPos((x, y)) | |
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0) | |
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0) | |
def PointsInCircum(r, n=num_of_points): | |
#https://stackoverflow.com/questions/8487893/generate-all-the-points-on-the-circumference-of-a-circle | |
return [(math.cos(2*math.pi/n*x)*r, math.sin(2*math.pi/n*x)*r) for x in range(0, n+1)] | |
for r in range(narrowest, widest, num_of_points): | |
for i in PointsInCircum(r, 100): | |
x = int(i[0]) + 360 | |
y = int(i[1]) + 360 | |
print(str(x) + " " + str(y)) | |
click(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment