AutoDraw icon indicating copy to clipboard operation
AutoDraw copied to clipboard

Features?

Open AnthonyHomie opened this issue 4 years ago • 2 comments

Is there anyway to change where the mouse starts drawing by X and Y and for it to start drawing the image so that position will be the top left corner of the image being drawn? And add control of scaling the images drawing?

AnthonyHomie avatar May 13 '21 01:05 AnthonyHomie

Scale:

AutoDraw get screen size to calculate scale and position.

Because I have two monitors so it was using wrong size and I added option screen_size to set it manually.

ad = AutoDraw(image, screen_size=(1920, 1200))

If you use ie. screen_size = (400, 400) then you get smaller image

ad = AutoDraw(image, screen_size=(400, 400))

Start X, Y:

In __init__ there are variables self.startX, self.startY which define where it starts drawing. These values are calculated using self.scale = 7/12 and screen_size. If you set self.scale = 1 then it gives startX = 0, startY = 0 but it is position on screen/desktop, not on canvas/paper and it will click buttons on toolbars. You have to keep some margin to skip toolbars. Code can work with any drawing program - because it uses only mouse clicks - but it doesn't know how many space use toolbars. You could try to find better value for self.scale but it can be simply to assign values directly to self.startX, self.startYin init`.

Later I can change code to add startX, startX as options in AutoDraw(...)

furas avatar May 13 '21 16:05 furas

Now AutoDraw(...) has options with default values

screen_size=None, 
start_x=None, 
start_y=None, 
detail=1, 
scale=7/12, 
sketch_before=False, 
with_color=True, 
num_colors=10, 
outline_again=False,

If you don't set screen_size then it will use PyAutoGUI.size() to get screen size.

If you don't set start_x, start_y then it will calculate it using screen_size and scale

furas avatar May 16 '21 20:05 furas