How to draw images with python under 10 lines of code [SUPER EASY!!]
IN THIS BLOG POST
- python installation
- what is sketchpy
- how to install sketchpy
- how to draw Robert Downy Jr with sketchpy
INSTALLING PYTHON
Prerequisties
- A system running Windows 10 with admin privileges
- Command Prompt (comes with Windows by default)
- A Remote Desktop Connection app (use if you are installing Python on a remote Windows server)
- A system running Windows 10 with admin privileges
- Command Prompt (comes with Windows by default)
- A Remote Desktop Connection app (use if you are installing Python on a remote Windows server)
Step 1 (Version Selection)
- select the python version you are willing to install(3.10.x - recommended)
- If you are installing Python on a remote Windows server, log in via Remote Desktop Protocol (RDP). Once your logged in, the installation procedure is the same as for a local windows machine.
Step 2 (Download Python Executable)
- Open your web browser and navigate to the Downloads for Windows section of the official Python website.
- Search for your desired version of Python. At the time of publishing this article, the latest Python 3 release is version 3.10.2
.
- Select a link to download either the Windows x86-64 executable installer or Windows x86 executable installer. The download is approximately 25MB.
- Run the Python Installer once downloaded. (In this example, we have downloaded Python 3.7.3.)
Make sure you select the Install launcher for all users and Add Python 3.10 to PATH checkboxes. The latter places the interpreter in the execution path.
Select Install Now – the recommended installation options
Step 4 (verify Python was installed Properly)
- Open your command prompt, and type python and hit ENTER
- if you see output as shown below your installation was successful
Step 5 (Verify pip was installed Properly)
- in the same command prompt type pip -V
- If you see the version of pip then it is installed properly
- If not then you need to add python to path during installation
What is Sketchpy
- It is a python package developed by me
- It is basically used to draw some predefined images
- You can also draw your own images
- But that's a topic for another Post
INSTALLING SKETCHPY
- Open your Command prompt
- Enter the Following code and hit enter
pip install sketchpy
I have already install it , If your are installing for the first time, it would somewhat different
If you see some error in installation try installing opencv, tutrle , then finally install sketchpy
pip install opencv-python turtle sketchpy
Let's Draw Robert Downy Jr
- Open your fav text editor or you can also use the default text editor comes from python known as IDLE
- type the following code and run it
from sketchpy import library as lib
obj = lib.rdj()
obj.draw()
obj = lib.rdj()
obj.draw()
That's it you have successfully drawn RDJ with python with just 3 lines of code
For more such codes and creative programs , follow me on YouTube
If you get any error, contact me on discord
If you want to contribute on this project , GitHub link is here
Post a Comment