How To Create Computer Design Using Python turtle #python #programming #coding #graphics

preview_player
Показать описание
This tutorial will create a cartoon-style computer design using the Python turtle library. The design will include a monitor, a keyboard, and some details to make it visually appealing. So guys let's have some fun by making some excellent graphics in Python turtle.
Complete code:

import turtle

# Set up the screen
screen = turtle.Screen()

# Create a turtle for drawing
artist = turtle.Turtle()

# Function to draw a rectangle
def draw_rectangle(t, x, y, width, height, color):
for _ in range(2):

# Function to draw a screen (monitor)
def draw_monitor():
# Monitor body
draw_rectangle(artist, -150, 50, 300, 200, "grey")
# Screen
draw_rectangle(artist, -140, 60, 280, 180, "black")

# Function to draw a stand
def draw_stand():
# Stand base
draw_rectangle(artist, -50, -50, 100, 20, "darkgrey")
# Stand neck
draw_rectangle(artist, -20, 0, 40, 50, "darkgrey")

# Function to draw a keyboard
def draw_keyboard():
# Keyboard body
draw_rectangle(artist, -200, -100, 400, 50, "grey")
# Keys (simple lines)
for row in range(4):
for col in range(10):

# Draw the computer
draw_monitor()
draw_stand()
draw_keyboard()

# Hide the turtle and display the design
Рекомендации по теме
Комментарии
Автор

Like: play this keys on board of piano to play rush e

selvo
join shbcf.ru