defi_twitter.py

Created by adam-y

Created on April 09, 2023

1.32 KB

https://twitter.com/nsi_xyz/status/1641897276326006786


from kandinsky import fill_rect
from random import randint
from turtle import *

hideturtle()
speed(10)

def defi1():
  fill_rect(40, 60, 240, 140, 'black')
  fill_rect(50, 70, 220, 120, 'white')
  hideturtle()
  pensize(5)
  speed(10)
  for angle in [135, 45]:
    penup()
    goto(0, 50)
    setheading(angle)
    pendown()
    forward(50)
  while True:
    coord_x = randint(50, 220)
    coord_y = randint(70, 120)
    longueur = randint(0, 220)
    largeur = randint(0, 120)
    couleur = (randint(0, 255), randint(0, 255), randint(0, 255))
    if coord_x + longueur > 270 or coord_y + largeur > 190:
      continue
    fill_rect(coord_x, coord_y, longueur, largeur, couleur)

def defi2():
  pensize(11)
  circle(1)
  for i in range(0, 200, 10):
    color(i, i, i)
    penup(); goto(0, -i); pendown()
    circle(i)

def defi3():
  pensize(11)
  for i in range(0, 240, 10):
    color(i, i, i)
    penup(); goto(-160, 120 - i); pendown()
    forward(320)
  color('yellow')
  penup(); goto(-50, 50); pendown()
  setheading(-135)
  forward(100)
  setheading(0)
  forward(100)
  penup(); goto(-50, 0); pendown()
  setheading(-90)
  forward(50)
  penup(); goto(40, 50); pendown()
  setheading(0)
  forward(50)
  setheading(-90)
  forward(50)
  setheading(180)
  forward(50)
  setheading(-90)
  forward(50)
  setheading(0)
  forward(50)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.