Rectangle with pencil in paint with the help of Python programming

How to create rectangle with the help of pencil in python as per below?





Here is the answer.

Requirements :-
PYAUTOGUI Library of the Python 


Code
import pyautogui
import time
pyautogui.moveTo(320,320)
time.sleep(0.1)
pyautogui.mouseDown()
x=320
y=320
while y<=420:
pyautogui.moveTo(x,y)
while x<=540:
x=x+110
pyautogui.moveTo(x,y)
x=320
y=y+1
pyautogui.mouseUp()


Steps to perform operation:

!)    Open Visual Studio Code (if not installed download from here)
2)    Create python file then Copy and paste the code
3)    Open paint -> select pencil or brush and arrange window as given below



4)    Run the code .
5)    wait for the code to stop

Done ! you had drawn rectangle with the help of the pencil
comment down below for any query.

(Caution : Modifying code can make code operate in infinite loop so perform operation with caution)





Comments