{"id":10145,"date":"2022-05-04T21:43:18","date_gmt":"2022-05-04T16:13:18","guid":{"rendered":"https:\/\/copyassignment.com\/?p=10145"},"modified":"2022-12-05T16:48:27","modified_gmt":"2022-12-05T11:18:27","slug":"draw-car-using-python-turtle","status":"publish","type":"post","link":"https:\/\/copyassignment.com\/draw-car-using-python-turtle\/","title":{"rendered":"Draw Car using Python Turtle"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>Hello and thank you for visiting <a href=\"https:\/\/copyassignment.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">violet-cat-415996.hostingersite.com<\/a>. We&#8217;ll look at how to Draw Car using Python Turtle in this post. This will be a brief but informative post, especially for beginners, because we have commented on every line of code so that even a rookie can understand the concept.<\/p>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-9886351916045880\" data-ad-slot=\"2002566052\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>The car will be constructed in stages. We&#8217;ll start at the bottom left and work our way up, drawing the composite shapes that make up the car until we&#8217;re finished.<\/p>\n\n\n\n<p>To draw a car&nbsp;with Python Turtle, you must think of it in terms of particular shapes. Tyers can be drawn using the rectangle forward function. The upper body of a car can be thought of as a rectangle. And roof and window are drawn using slanted lines.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. To begin, we&#8217;ll import the Python Turtle module, execute the delay function, and increase the turtle&#8217;s pen size.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import turtle\nvatsal = turtle.Turtle()\nturtle.delay(10)\nvatsal.pensize(7)\nturtle.Screen().bgcolor(\"#F5F5DC\")\nvatsal.speed(10)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.<\/strong> <strong>After that, we&#8217;ll move the turtle to the far left. We want to draw with a scale factor of 25, therefore we&#8217;ll double whatever coordinate we obtain by 25.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Move the turtle to the extreme left position\nvatsal.penup()\nvatsal.setposition(-200,-75)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Now you should create a rectangle with a length of 400 and a width of 150.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the rectangle\nvatsal.fillcolor(\"#46523C\")\nvatsal.begin_fill()\nvatsal.pendown()\nvatsal.forward(400)\nvatsal.setheading(90)\nvatsal.forward(150)\nvatsal.setheading(180)\nvatsal.forward(400)\nvatsal.setheading(-90)\nvatsal.forward(150)\nvatsal.end_fill()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Now We are going to draw the tyers.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the left tire\nvatsal.fillcolor(\"black\")\nvatsal.begin_fill()\nvatsal.penup()\nvatsal.setposition(-175,-75)\nvatsal.pendown()\nvatsal.forward(50)\nvatsal.setheading(0)\nvatsal.forward(75)\nvatsal.setheading(90)\nvatsal.forward(50)\nvatsal.end_fill()\n\n# Draw the right tire\nvatsal.penup()\nvatsal.setposition(100,-75)\nvatsal.fillcolor(\"black\")\nvatsal.begin_fill()\nvatsal.pendown()\nvatsal.setheading(270)\nvatsal.forward(50)\nvatsal.setheading(0)\nvatsal.forward(75)\nvatsal.setheading(90)\nvatsal.forward(50)\nvatsal.end_fill()\n<\/code><\/pre>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-9886351916045880\" data-ad-slot=\"2002566052\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Now we&#8217;re going to draw the top line.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the uppermost line\n\nvatsal.penup()\nvatsal.setposition(-137.5,200)\nvatsal.pendown()\nvatsal.setheading(0)\nvatsal.forward(275)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>The second topmost line will be drawn next.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the second uppermost line\nvatsal.penup()\nvatsal.setposition(-150,150)\nvatsal.pendown()\nvatsal.setheading(0)\nvatsal.forward(300)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>The left and right slanting lines must be drawn to complete the shape of the car.<\/strong><\/h3>\n\n\n\n<p><strong>Simply draw a line from the uppermost line&#8217;s tip to where the left-slanting line should contact the rectangle to create the left-slanting line.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the left slanted line\nvatsal.penup()\nvatsal.setposition(-137.5,200)\nvatsal.pendown()\nvatsal.setposition(-175,75)\n\n# Draw the right slanted line\nvatsal.penup()\nvatsal.setposition(137.5,200)\nvatsal.pendown()\nvatsal.setposition(175,75)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8. We can now sketch the car properly. The headlights will be adjusted initially. First, we&nbsp;create a circle for the left headlight and then a circle for the right headlight.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the left circle\n\nvatsal.penup()\nvatsal.setposition(-125,-25)\nvatsal.pendown()\nvatsal.fillcolor(\"#ECFFDC\")\nvatsal.begin_fill()\nvatsal.circle(25)\nvatsal.end_fill()\n# Draw the right circle\nvatsal.penup()\nvatsal.setposition(125,-25)\nvatsal.pendown()\nvatsal.fillcolor(\"#ECFFDC\")\nvatsal.begin_fill()\nvatsal.circle(25)\nvatsal.end_fill()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. <strong>Now the wipers are to be drawn. The left wiper will be drawn first, followed by the second wiper.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the left wiper\nvatsal.penup()\nvatsal.setposition(-87.5, 75)\nvatsal.pendown()\nvatsal.setposition(-50, 112.5)\n\n# Draw the right wiper\nvatsal.penup()\nvatsal.setposition(62.5, 75)\nvatsal.pendown()\nvatsal.setposition(100, 112.5)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. <strong>Finally, the four horizontal lines are sketched.<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Draw the horizontal lines\nvatsal.penup()\nvatsal.setposition(-50, -37.5)\nvatsal.pendown()\nvatsal.setposition(-50, 0)\nvatsal.penup()\nvatsal.setposition(-15, -37.5)\nvatsal.pendown()\nvatsal.setposition(-15, 0)\nvatsal.penup()\nvatsal.setposition(15, -37.5)\nvatsal.pendown()\nvatsal.setposition(15, 0)\nvatsal.penup()\nvatsal.setposition(50, -37.5)\nvatsal.pendown()\nvatsal.setposition(50, 0)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Complete Code to Draw Car using Python Turtle<\/h2>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-9886351916045880\" data-ad-slot=\"2002566052\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><div style=\"position:absolute;top:-20px;right:0px;cursor:pointer\" class=\"copy-simple-code-block\"><span class=\"dashicon dashicons dashicons-admin-page\"><\/span><\/div><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"python\" data-theme=\"xcode\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"true\">import turtle\nvatsal = turtle.Turtle()\nturtle.delay(10)\nvatsal.pensize(7)\nturtle.Screen().bgcolor(\"#F5F5DC\")\nvatsal.speed(10)\n\n# Move the turtle to the extreme left position\nvatsal.penup()\nvatsal.setposition(-200,-75)\n\n\n# Draw the rectangle\nvatsal.fillcolor(\"#46523C\")\nvatsal.begin_fill()\nvatsal.pendown()\nvatsal.forward(400)\nvatsal.setheading(90)\nvatsal.forward(150)\nvatsal.setheading(180)\nvatsal.forward(400)\nvatsal.setheading(-90)\nvatsal.forward(150)\nvatsal.end_fill()\n\n# Draw the left tire\nvatsal.fillcolor(\"black\")\nvatsal.begin_fill()\nvatsal.penup()\nvatsal.setposition(-175,-75)\nvatsal.pendown()\nvatsal.forward(50)\nvatsal.setheading(0)\nvatsal.forward(75)\nvatsal.setheading(90)\nvatsal.forward(50)\nvatsal.end_fill()\n\n# Draw the right tire\nvatsal.penup()\nvatsal.setposition(100,-75)\nvatsal.fillcolor(\"black\")\nvatsal.begin_fill()\nvatsal.pendown()\nvatsal.setheading(270)\nvatsal.forward(50)\nvatsal.setheading(0)\nvatsal.forward(75)\nvatsal.setheading(90)\nvatsal.forward(50)\nvatsal.end_fill()\n\n# Draw the uppermost line\n\nvatsal.penup()\nvatsal.setposition(-137.5,200)\nvatsal.pendown()\nvatsal.setheading(0)\nvatsal.forward(275)\n\n# Draw the second uppermost line\nvatsal.penup()\nvatsal.setposition(-150,150)\nvatsal.pendown()\nvatsal.setheading(0)\nvatsal.forward(300)\n\n# Draw the left slanted line\nvatsal.penup()\nvatsal.setposition(-137.5,200)\nvatsal.pendown()\nvatsal.setposition(-175,75)\n\n# Draw the right slanted line\nvatsal.penup()\nvatsal.setposition(137.5,200)\nvatsal.pendown()\nvatsal.setposition(175,75)\n\n# Draw the left circle\n\nvatsal.penup()\nvatsal.setposition(-125,-25)\nvatsal.pendown()\nvatsal.fillcolor(\"#ECFFDC\")\nvatsal.begin_fill()\nvatsal.circle(25)\nvatsal.end_fill()\n# Draw the right circle\nvatsal.penup()\nvatsal.setposition(125,-25)\nvatsal.pendown()\nvatsal.fillcolor(\"#ECFFDC\")\nvatsal.begin_fill()\nvatsal.circle(25)\nvatsal.end_fill()\n\n# Draw the left wiper\nvatsal.penup()\nvatsal.setposition(-87.5, 75)\nvatsal.pendown()\nvatsal.setposition(-50, 112.5)\n\n# Draw the right wiper\nvatsal.penup()\nvatsal.setposition(62.5, 75)\nvatsal.pendown()\nvatsal.setposition(100, 112.5)\n\n# Draw the horizontal lines\nvatsal.penup()\nvatsal.setposition(-50, -37.5)\nvatsal.pendown()\nvatsal.setposition(-50, 0)\nvatsal.penup()\nvatsal.setposition(-15, -37.5)\nvatsal.pendown()\nvatsal.setposition(-15, 0)\nvatsal.penup()\nvatsal.setposition(15, -37.5)\nvatsal.pendown()\nvatsal.setposition(15, 0)\nvatsal.penup()\nvatsal.setposition(50, -37.5)\nvatsal.pendown()\nvatsal.setposition(50, 0)<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Output:<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"664\" height=\"471\" data-src=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/05\/Capture.png\" alt=\"output-&gt; Draw Car using Python Turtle \" class=\"wp-image-10146 lazyload\" data-srcset=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/05\/Capture.png 664w, https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/05\/Capture-300x213.png 300w\" data-sizes=\"(max-width: 664px) 100vw, 664px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 664px; --smush-placeholder-aspect-ratio: 664\/471;\" \/><\/figure>\n\n\n\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-9886351916045880\"\n     crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\"\n     style=\"display:block\"\n     data-ad-format=\"autorelaxed\"\n     data-ad-client=\"ca-pub-9886351916045880\"\n     data-ad-slot=\"7933252109\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<div style=\"text-align:center\" class=\"wp-block-atomic-blocks-ab-button ab-block-button\"><a href=\"https:\/\/copyassignment.com\/category\/python-turtle\/\" class=\"ab-button ab-button-shape-rounded ab-button-size-medium\" style=\"color:#ffffff;background-color:#3373dc\">Click to get Best Turtle Projects<\/a><\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><strong>Also Read:<\/strong><\/p>\n\n\n<ul class=\"wp-block-latest-posts__list is-grid columns-3 wp-block-latest-posts\"><li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/create-your-own-chatgpt-with-python\/\">Create your own ChatGPT with\u00a0Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/sqlite-crud-operations-in-python\/\">SQLite | CRUD Operations in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/event-management-system-project-in-python\/\">Event Management System Project in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/ticket-booking-and-management-in-python\/\">Ticket Booking and Management in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/radha-krishna-using-python-turtle\/\">Radha Krishna using Python Turtle<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/hostel-management-system-project-in-python\/\">Hostel Management System Project in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/sales-management-system-project-in-python\/\">Sales Management System Project in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/bank-management-system-project-in-cpp\/\">Bank Management System Project in C++<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/python-download-file-from-url-4-methods\/\">Python Download File from URL | 4 Methods<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/python-programming-examples-fundamental-programs-in-python\/\">Python Programming Examples | Fundamental Programs in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/drawing-letter-a-using-python-turtle\/\">Drawing letter A using Python Turtle<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/spell-checker-in-python\/\">Spell Checker in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/portfolio-management-system-in-python\/\">Portfolio Management System in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/stickman-game-in-python\/\">Stickman Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/contact-book-project-in-python\/\">Contact Book project in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/loan-management-system-project-in-python\/\">Loan Management System Project in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/cab-booking-system-in-python\/\">Cab Booking System in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/brick-breaker-game-in-python\/\">Brick Breaker Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/wishing-happy-new-year-2023-in-python-turtle\/\">Wishing Happy New Year 2023 in Python Turtle<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/tank-game-in-python\/\">Tank game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/gui-piano-in-python\/\">GUI Piano in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/ludo-game-in-python\/\">Ludo Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/rock-paper-scissors-game-in-python\/\">Rock Paper Scissors Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/snake-and-ladder-game-in-python\/\">Snake and Ladder Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/puzzle-game-in-python\/\">Puzzle Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/draw-goku-in-python-turtle\/\">Draw Goku in Python Turtle<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/medical-store-management-system-project-in-python\/\">Medical Store Management System Project in\u00a0Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/draw-mickey-mouse-in-python-turtle\/\">Draw Mickey Mouse in Python Turtle<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/creating-dino-game-in-python\/\">Creating Dino Game in Python<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/tic-tac-toe-game-in-python\/\">Tic Tac Toe Game in Python<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Introduction Hello and thank you for visiting violet-cat-415996.hostingersite.com. We&#8217;ll look at how to Draw Car using Python Turtle in this post. This will be a&#8230;<\/p>\n","protected":false},"author":62,"featured_media":10162,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,1067],"tags":[1421,1420,1093,1100],"class_list":["post-10145","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-allcategorites","category-python-turtle","tag-car","tag-draw-car-using-python-turtle","tag-turtle-design","tag-turtle-python","wpcat-22-id","wpcat-1067-id"],"_links":{"self":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/posts\/10145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/comments?post=10145"}],"version-history":[{"count":0,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/posts\/10145\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/media\/10162"}],"wp:attachment":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/media?parent=10145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/categories?post=10145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/tags?post=10145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}