Draw and erase shapes in Python with Turtle: Beginner Coding Tutorial

Publicado el: 01 julio 2025
en el canal de: Rivan
26
3

This is the code to draw and Clear a red square using buttons in Python.

import turtle
t = turtle.Pen()
def redsq50():
turtle.color(1,0,0)
turtle.begin_fill()
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.end_fill()


from tkinter import *
tk = Tk()
btn = Button(tk, text = "red square", command=redsq50)
btn.pack()
def clearscreen():
turtle.clear()
turtle.reset()


btn = Button(tk, text = "Clear all", command=clearscreen)
btn.pack()


En esta página del sitio puede ver el video en línea Draw and erase shapes in Python with Turtle: Beginner Coding Tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario Rivan 01 julio 2025, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 26 veces y le gustó 3 a los espectadores. Disfruta viendo!