{"id":5533,"date":"2019-11-28T20:31:27","date_gmt":"2019-11-28T20:31:27","guid":{"rendered":"https:\/\/holypython.com\/?p=5533"},"modified":"2021-03-28T00:50:15","modified_gmt":"2021-03-28T00:50:15","slug":"turtle-rotating-rectangles","status":"publish","type":"post","link":"https:\/\/holypython.com\/turtle-rotating-rectangles\/","title":{"rendered":"Turtle Rotating Rectangles"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"5533\" class=\"elementor elementor-5533\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-53b32a8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"53b32a8\" data-element_type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cfc2f91\" data-id=\"cfc2f91\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2d2899d elementor-widget elementor-widget-heading\" data-id=\"2d2899d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><b>Drawing Rotating Rectangles<\/b><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-eeb1e41 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"eeb1e41\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b341562\" data-id=\"b341562\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-688cdc8 elementor-widget elementor-widget-text-editor\" data-id=\"688cdc8\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here is another Python turtle example showing how to edit the background color of turtle screen and how to use RGB mode.<\/p><p>This example can give you a good understanding of RGB channels in images.<\/p><p>Here is a simply code that uses\u00a0<b>requests<\/b>, <b>json<\/b> and <b>webbrowser <\/b>libraries:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e0a8e27 elementor-widget elementor-widget-html\" data-id=\"e0a8e27\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>import turtle\r\nimport random\r\n\r\nx = 1\r\nSN = turtle.Screen()\r\nSN.bgcolor(\"gray\")\r\na = turtle.Turtle()\r\na.speed(100)\r\n\r\ni = 0\r\nwhile x < 256:\r\n\r\n    r = random.randint(0,255)\r\n    g = 100\r\n    b = 150\r\n    \r\n    turtle.colormode(255)\r\n    a.pencolor(i,g,b)\r\n    if x<252:\r\n        a.pensize(1)\r\n        a.forward(50 + x)\r\n        a.right(91.5)\r\n       \r\n    x = x+1\r\n    i = (i+1)%255    \r\n\r\nturtle.done()   <\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3ce7f6f elementor-widget elementor-widget-image\" data-id=\"3ce7f6f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"863\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1-1024x863.jpg\" class=\"attachment-large size-large wp-image-5560\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1-1024x863.jpg 1024w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1-300x253.jpg 300w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1-768x648.jpg 768w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1-1536x1295.jpg 1536w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1-600x506.jpg 600w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/python-rectangle-1.jpg 1569w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-813bf3d elementor-widget elementor-widget-text-editor\" data-id=\"813bf3d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Code below will print a bunch of other information regarding cocktails such as: Instructions and Ingredients and it will also open the cocktail image in a browser.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-68440db elementor-widget elementor-widget-html\" data-id=\"68440db\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre><code>import turtle\r\n\r\na = turtle.Turtle()\r\nfor i in range(240):\r\n    a.forward(2+i\/4)\r\n    a.left(30-i\/12)\r\n\r\nturtle.done()<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6fde466 elementor-widget elementor-widget-image\" data-id=\"6fde466\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"861\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3-1024x861.jpg\" class=\"attachment-large size-large wp-image-5522\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3-1024x861.jpg 1024w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3-300x252.jpg 300w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3-768x646.jpg 768w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3-1536x1291.jpg 1536w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3-600x504.jpg 600w, https:\/\/holypython.com\/wp-content\/uploads\/2019\/11\/Turtle-spiral3.jpg 1881w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ce79508 elementor-widget elementor-widget-text-editor\" data-id=\"ce79508\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If you need a refresher on Python Turtle, here is a link to our Python Turtle lesson.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Drawing Rotating Rectangles Here is another Python turtle example showing how to edit the background color of turtle screen and how to use RGB mode. This example can give you a good understanding of RGB channels in images. Here is a simply code that uses\u00a0requests, json and webbrowser libraries: import turtle import random x = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5560,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[42],"tags":[],"class_list":["post-5533","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-turtle"],"acf":[],"_links":{"self":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts\/5533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/comments?post=5533"}],"version-history":[{"count":0,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/posts\/5533\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media\/5560"}],"wp:attachment":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media?parent=5533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/categories?post=5533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/tags?post=5533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}