Mostrando entradas con la etiqueta Graficacion. Mostrar todas las entradas
Mostrando entradas con la etiqueta Graficacion. Mostrar todas las entradas

martes, 7 de noviembre de 2017

Figuras 3D en Python

Cubo

import pygame
from pygame.locals import *

from OpenGL.GL import *
from OpenGL.GLU import *

verticies = (
    (1, -1, -1),
    (1, 1, -1),
    (-1, 1, -1),
    (-1, -1, -1),
    (1, -1, 1),
    (1, 1, 1),
    (-1, -1, 1),
    (-1, 1, 1)
    )

edges = (
    (0,1),
    (0,3),
    (0,4),
    (2,1),
    (2,3),
    (2,7),
    (6,3),
    (6,4),
    (6,7),
    (5,1),
    (5,4),
    (5,7)
    )


def Cube():
    glBegin(GL_LINES)
    for edge in edges:
        for vertex in edge:
            glVertex3fv(verticies[vertex])
    glEnd()


def main():
    pygame.init()
    display = (800,600)
    pygame.display.set_mode(display, DOUBLEBUF|OPENGL)

    gluPerspective(45, (display[0]/display[1]), 0.1, 50.0)

    glTranslatef(0.0,0.0, -5)

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()

        glRotatef(1, 3, 1, 1)
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
        Cube()
        pygame.display.flip()
        pygame.time.wait(10)


main()







Triangulo


import pygame
from pygame.locals import *

from OpenGL.GL import *
from OpenGL.GLU import *

verticies = (
    (1, -1, -1),
    (1, 1, -1),
    (-1, 1, -1),
    (-1, -1, -1),
    (0,0,1)

    )

edges = (
    (4,0),
    (4,1),
    (4,2),
    (4,3),
    (0,1),
    (0,3),
    (2,1),
    (2,3)

    )


def Cube():
    glBegin(GL_LINES)
    for edge in edges:
        for vertex in edge:
            glVertex3fv(verticies[vertex])
    glEnd()


def main():
    pygame.init()
    display = (800,600)
    pygame.display.set_mode(display, DOUBLEBUF|OPENGL)

    gluPerspective(45, (display[0]/display[1]), 0.1, 50.0)

    glTranslatef(0.0,0.0, -5)

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()

        glRotatef(1, 3, 1, 1)
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
        Cube()
        pygame.display.flip()
        pygame.time.wait(10)


main()






Cubo de color


import sys, math, pygame
from operator import itemgetter


class Point3D:
    def __init__(self, x=0, y=0, z=0):
        self.x, self.y, self.z = float(x), float(y), float(z)

    def rotateX(self, angle):
        """ Rotates the point around the X axis by the given angle in degrees. """        rad = angle * math.pi / 180        cosa = math.cos(rad)
        sina = math.sin(rad)
        y = self.y * cosa - self.z * sina
        z = self.y * sina + self.z * cosa
        return Point3D(self.x, y, z)

    def rotateY(self, angle):
        """ Rotates the point around the Y axis by the given angle in degrees. """        rad = angle * math.pi / 180        cosa = math.cos(rad)
        sina = math.sin(rad)
        z = self.z * cosa - self.x * sina
        x = self.z * sina + self.x * cosa
        return Point3D(x, self.y, z)

    def rotateZ(self, angle):
        """ Rotates the point around the Z axis by the given angle in degrees. """        rad = angle * math.pi / 180        cosa = math.cos(rad)
        sina = math.sin(rad)
        x = self.x * cosa - self.y * sina
        y = self.x * sina + self.y * cosa
        return Point3D(x, y, self.z)

    def project(self, win_width, win_height, fov, viewer_distance):
        """ Transforms this 3D point to 2D using a perspective projection. """        factor = fov / (viewer_distance + self.z)
        x = self.x * factor + win_width / 2        y = -self.y * factor + win_height / 2        return Point3D(x, y, self.z)


class Simulation:
    def __init__(self, win_width=640, win_height=480):
        pygame.init()

        self.screen = pygame.display.set_mode((win_width, win_height))
        pygame.display.set_caption("Figura de cubo 3D en python")

        self.clock = pygame.time.Clock()

        self.vertices = [
            Point3D(-1, 1, -1),
            Point3D(1, 1, -1),
            Point3D(1, -1, -1),
            Point3D(-1, -1, -1),
            Point3D(-1, 1, 1),
            Point3D(1, 1, 1),
            Point3D(1, -1, 1),
            Point3D(-1, -1, 1)
        ]

        # Define the vertices that compose each of the 6 faces. These numbers are        # indices to the vertices list defined above.        self.faces = [(0, 1, 2, 3), (1, 5, 6, 2), (5, 4, 7, 6), (4, 0, 3, 7), (0, 4, 5, 1), (3, 2, 6, 7)]

        # Define colors for each face        self.colors = [(180, 0, 200), (13, 0, 0), (0, 150, 0), (0, 0, 90), (0, 210, 180), (100, 90, 0)]

        self.angle = 0
    def run(self):
        """ Main Loop """        while 1:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()

            self.clock.tick(50)
            self.screen.fill((0, 32, 0))

            # It will hold transformed vertices.            t = []

            for v in self.vertices:
                # Rotate the point around X axis, then around Y axis, and finally around Z axis.                r = v.rotateX(self.angle).rotateY(self.angle).rotateZ(self.angle)
                # Transform the point from 3D to 2D                p = r.project(self.screen.get_width(), self.screen.get_height(), 256, 4)
                # Put the point in the list of transformed vertices                t.append(p)

            # Calculate the average Z values of each face.            avg_z = []
            i = 0            for f in self.faces:
                z = (t[f[0]].z + t[f[1]].z + t[f[2]].z + t[f[3]].z) / 4.0                avg_z.append([i, z])
                i = i + 1
            # Draw the faces using the Painter's algorithm:            # Distant faces are drawn before the closer ones.            for tmp in sorted(avg_z, key=itemgetter(1), reverse=True):
                face_index = tmp[0]
                f = self.faces[face_index]
                pointlist = [(t[f[0]].x, t[f[0]].y), (t[f[1]].x, t[f[1]].y),
                             (t[f[1]].x, t[f[1]].y), (t[f[2]].x, t[f[2]].y),
                             (t[f[2]].x, t[f[2]].y), (t[f[3]].x, t[f[3]].y),
                             (t[f[3]].x, t[f[3]].y), (t[f[0]].x, t[f[0]].y)]
                pygame.draw.polygon(self.screen, self.colors[face_index], pointlist)

            self.angle += 1
            pygame.display.flip()


if __name__ == "__main__":
    Simulation().run()



Graficas en 3D
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt


fig = plt.figure()
ax1 = fig.add_subplot(111, projection='3d')

xpos = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
ypos = [2,3,4,5,1,6,2,1,7,2,3,5,1,3,2]
num_elements = len(xpos)
zpos = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
dx = 1dy =1dz = [20,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

ax1.bar3d(xpos, ypos, zpos, dx, dy, dz, color='red')
plt.show()

martes, 24 de octubre de 2017

Programa Final




Tropa de tortugas

from turtle import *
import tkSimpleDialog

wn = Screen()

tess = Turtle()

b=tkSimpleDialog.askstring("hola","Dame el color de las tortugas")
c=tkSimpleDialog.askstring("hola","Dame el color del fondo")
a=tkSimpleDialog.askinteger("hola","Dame el numero de tortugas")

tess.color(b)
wn.bgcolor(c)
tess.shape("turtle")


tess.up()                       # otra forma de levantar el lapizfor dist in range(2,a):       # dist = "1" , cantidad = "2"    tess.stamp()                # deja una impresion    tess.forward(dist)          # move tess along    tess.right(24)              # voltear
wn.exitonclick()


Arbol

import turtle
lapiz2=turtle.Turtle()
lapiz2.speed(100)
lapiz2.hideturtle()
c=1
def arbol(tam,lapiz,i):
     if tam > 5:
        lapiz.forward(tam)
        lapiz.right(20)
        a=lapiz.pos()
        if i==1:
         hojas(a,lapiz2)
        elif i==2:
            hojasoto(a, lapiz2)
        elif i==3:
         hojasinvi(a, lapiz2)
        arbol(tam-15,lapiz,i)
        lapiz.left(40)
        arbol(tam-15,lapiz,i)
        lapiz.right(20)
        lapiz.up
        lapiz.backward(tam)
        lapiz.down
def dibujar():
    i=1
    lapiz1 = turtle.Turtle()
    lapiz1.hideturtle()
    pantalla = turtle.Screen()
    lapiz1.speed(100)
    lapiz1.pensize(1)
    lapiz1.left(90)
    lapiz1.up()
    lapiz1.backward(50)
    lapiz1.down()
    lapiz1.color("black")
    for i in range (4):
     arbol(120,lapiz1,i)
    pantalla.exitonclick()
def hojas(a,lapiz):
    lapiz.fillcolor("green")
    lapiz.penup()
    lapiz.goto(a)
    lapiz.pendown()
    lapiz.begin_fill()
    lapiz.circle(5)
    lapiz.end_fill()
def hojasoto(a,lapiz):
    lapiz.fillcolor("brown")
    lapiz.begin_fill()
    lapiz.penup()
    lapiz.goto(a)
    lapiz.pendown()
    lapiz.circle(5)
    lapiz.end_fill()
def hojasinvi(a,lapiz):
    lapiz.reset()
dibujar()

Planetas

from turtle import Turtle, Screen

""" Simulate motion of Mercury, Venus, Earth, and Mars """
planets = {
    'mercury': {'diameter': 0.383, 'orbit': 58, 'speed': 7.5, 'color': 'gray'},
    'venus': {'diameter': 0.949, 'orbit': 108, 'speed': 3, 'color': 'yellow'},
    'earth': {'diameter': 1.0, 'orbit': 150, 'speed': 2, 'color': 'blue'},
    'mars': {'diameter': 0.532, 'orbit': 228, 'speed': 1, 'color': 'red'},
}

def setup_planets(planets):
    for planet in planets:
        dictionary = planets[planet]
        turtle = Turtle(shape='circle')

        turtle.speed("fastest")  # speed controlled elsewhere, disable here        turtle.shapesize(dictionary['diameter'])
        turtle.color(dictionary['color'])
        turtle.pu()
        turtle.sety(-dictionary['orbit'])
        turtle.pd()

        dictionary['turtle'] = turtle

    screen.ontimer(revolve, 50)

def revolve():
    for planet in planets:
        dictionary = planets[planet]
        dictionary['turtle'].circle(dictionary['orbit'], dictionary['speed'])

    screen.ontimer(revolve, 50)

screen = Screen()

setup_planets(planets)

screen.exitonclick()

miércoles, 18 de octubre de 2017

Figuras con for

cuadrado

import turtle

turtle.speed(1)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.exitonclick()

cuadrado con for

import turtle

turtle.speed(100)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
a=0
for x in range (40):
    turtle.forward(100)
    turtle.right(90)

    for i in range(1):
        turtle.forward(100)
        turtle.right(80)


turtle.exitonclick()

triangulo con for

import turtle

turtle.speed(100)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
a=0
for x in range (40):
    turtle.forward(100)
    turtle.left(120)

    #for i in range(10):
    #   turtle.forward(130)
     #   turtle.right(110)


turtle.exitonclick()

Rombo con for
import turtle

turtle.speed(1)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
a=0for x in range (3):
    turtle.forward(100)
    turtle.left(120)

turtle.home()

for x in range (3):
    turtle.forward(100)
    turtle.right(120)



turtle.exitonc

Figuras que piden color


Capturas:









Código:

Triangulo
import turtle
import tkSimpleDialog
turtle.speed(100)
fonde = turtle.Screen()
b=tkSimpleDialog.askstring("hola","Dame el color")
c=tkSimpleDialog.askstring("hola","Dame el color del fondo")
a=tkSimpleDialog.askstring("hola","Dame el color del relleno")
fonde.bgcolor(c)
turtle.pencolor(b)
turtle.fillcolor(a)
turtle.begin_fill()
for x in range (3):
    turtle.forward(100)
    turtle.left(120)

turtle.end_fill()

turtle.exitonclick()

Cuadrado
import turtle
import tkSimpleDialog
turtle.speed(100)
fonde = turtle.Screen()
b=tkSimpleDialog.askstring("hola","Dame el color")
c=tkSimpleDialog.askstring("hola","Dame el color del fondo")
a=tkSimpleDialog.askstring("hola","Dame el color del relleno")
fonde.bgcolor(c)
turtle.pencolor(b)
turtle.fillcolor(a)
turtle.begin_fill()
for x in range (4):
    turtle.forward(100)
    turtle.left(90)

turtle.end_fill()

turtle.exitonclick()

Octagono
import turtle
import tkSimpleDialog
turtle.speed(100)
fonde = turtle.Screen()
b=tkSimpleDialog.askstring("hola","Dame el color")
c=tkSimpleDialog.askstring("hola","Dame el color del fondo")
a=tkSimpleDialog.askstring("hola","Dame el color del relleno")
fonde.bgcolor(c)
turtle.pencolor(b)
turtle.fillcolor(a)
turtle.begin_fill()
for x in range (8):
    turtle.forward(100)
    turtle.left(45)

turtle.end_fill()

turtle.exitonclick()

lunes, 16 de octubre de 2017

Barquito

Programa del Barquito



Captura:




Código:

from turtle import *

setup(600,600,0,0)
pencolor("black")
pensize(2)
hideturtle()

fillcolor("brown")
begin_fill()
goto(-120, 0)
pendown()
goto(-80, -60)
goto(80, -60)
goto(120, 0)
goto(0,0)
end_fill()

fillcolor("black")
begin_fill()
penup()
goto(-20, 0)
pendown()
goto(-20,140)
goto(0,140)
goto(0,0)
end_fill()

fillcolor("white")
begin_fill()
penup()
goto(0,140)
pendown()
goto(80,100)
goto(0,60)
end_fill()
done()

martes, 10 de octubre de 2017

Figura propia con Turtle



Captura:

Código:

from turtle import *

setup(600,600,0,0)
pencolor("black")
pensize(2)
hideturtle()

penup()
goto(-40,185)
pendown()
goto(-40,100)
goto(-80,100)
goto(-80,-20)
goto(-40,-20)
goto(-40,-140)
goto(40,-140)
goto(40,-20)
goto(80,-20)
goto(80,100)
goto(40,100)
goto(40,185)
goto(-40,185)
penup()
#ojosgoto(-10, 150)
pendown()
goto(-30, 150)
goto(-30, 140)
goto(-10, 140)
goto(-10, 150)
penup()

goto(10, 150)
pendown()
goto(30, 150)
goto(30, 140)
goto(10, 140)
goto(10, 150)
penup()

#cabellogoto(-40, 160)
pendown()
goto(-30, 160)
goto(-30, 170)
goto(30, 170)
goto(30, 160)
goto(40, 160)
penup()

#Bocagoto(0,120)
pendown()
goto(10,120)
goto(10,130)
goto(20,130)
goto(20,110)
goto(0,110)
penup()
goto(0,120)
pendown()
goto(-10,120)
goto(-10,130)
goto(-20,130)
goto(-20,110)
goto(0,110)
penup()

#brazosgoto(-80,60)
pendown()
goto(-40,60)
goto(-40,-20)
penup()
goto(80, 60)
pendown()
goto(40,60)
goto(40,-20)
penup()

#piesgoto(-40, -120)
pendown()
goto(40, -120)
penup()

#cintogoto(-40, 0)
pendown()
goto(40, 0)
penup()

#pgoto(0, -40)
pendown()
goto(0, -140)
penup()

#cuellogoto(-40, 100)
pendown()
goto(-20, 100)
goto(0, 80)
penup()
goto(40, 100)
pendown()
goto( 20, 100)
goto(0, 80)
penup()
done()

domingo, 8 de octubre de 2017

Turtle

Programas con TURTLE


Tamaño y posición de la ventana
from turtle import *
setup(640, 480, 0, 0)
done()
__________________________________________________________________________

Definir titulo
from turtle import *
setup(450, 150, 0, 0)
title("Ejemplo de ventana")}
done()
__________________________________________________________________________
Sin setup la ventana se crea en el centro
from turtle import *
title("Ejemplo de ventana")
done()
__________________________________________________________________________
from turtle import *
setup(250, 100, 0, 0)
title("Ejemplo de ventana")
hideturtle()
dot(10, 0, 0, 0)
setup(450, 150, 0, 0)
done()
__________________________________________________________________________
Screensize define el tamaño del área de dibujo
from turtle import *
setup(450, 150, 0, 0)
screensize(10, 10)
done()
__________________________________________________________________________
Si la ventana es mas chica que el área de dibujo aparecerá una barra de desplazamiento
from turtle import *
setup(150, 150, 0, 0)
screensize(300, 300)
done ()

solo barra vertical:
from turtle import *
setup(450, 150, 0, 0)
screensize(400, 300)
done()
_________________________________________________________________________
Crear un punto
from turtle import *
setup(250, 100, 0, 0)
screensize(100, 100)
hideturtle()
dot(10, 0, 0, 0)
screensize(200, 100)
done()
__________________________________________________________________________
Mostrar cursor
from turtle import *
setup(450, 150, 0, 0)
screensize(300, 150)
showturtle()
done()
__________________________________________________________________________
Crear linea
from turtle import *
setup(450, 150, 0, 0)
screensize(300, 150)
goto(100, 0)
done()
__________________________________________________________________________
Oculta cursor
from turtle import *
setup(450, 150, 0, 0)
screensize(300, 150)
goto(100, 0)
hideturtle()
done()
_________________________________________________________________________
Ocultar tortuga desde el comienzo
from turtle import *

setup(450, 150, 0, 0)
screensize(300, 150)
hideturtle()
goto(100, 0)
done()
__________________________________________________________________________
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
goto(0, 0)
done()
__________________________________________________________________________

from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
goto(100, 50)
done()
__________________________________________________________________________
Dibujar segmentos
from turtle import *
setup(450, 200, 0, 0)
screensize(300, 150)
goto(100, 50)
goto(100, -50)
goto(50, -50)
done()
__________________________________________________________________________

from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)

goto(100, 50)
sety(-50)
setx(50)
done()
__________________________________________________________________________
Levantar y bajar lápiz
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)

goto(100, 50)
penup()
goto(100, -50)
pendown()
goto(50, -50)
done()
__________________________________________________________________________
Cambiar grosor de trazo
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)

goto(100, 50)
pensize(4)
goto(100, -50)
pensize(8)
goto(50, -50)
done()
__________________________________________________________________________
Color del trazo:
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
colormode(255)

pencolor(255, 0, 0)
goto(100, 50)
pencolor(0, 255, 0)
goto(100, -50)
pencolor(0, 0, 255)
goto(50, -50)
done()
__________________________________________________________________________
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
colormode(1)

pencolor(1, 0, 0)
goto(100, 50)
pencolor(0, 1, 0)
goto(100, -50)
pencolor(0, 0, 1)
goto(50, -50)
done()
__________________________________________________________________________
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
colormode(255)

pencolor(128, 0, 0)
goto(100, 50)
pencolor(0, 128, 0)
goto(100, -50)
pencolor(0, 0, 128)
goto(50, -50)
done()
__________________________________________________________________________
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
colormode(1)

pencolor(0.5, 0, 0)
goto(100, 50)
pencolor(0, 0.5, 0)
goto(100, -50)
pencolor(0, 0, 0.5)
goto(50, -50)
done()
__________________________________________________________________________
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)

pencolor("red")
goto(100, 50)
pencolor("green")
goto(100, -50)
pencolor("blue")
goto(50, -50)
done()
__________________________________________________________________________
Crear puntos de colores bajando lapiz
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
colormode(255)

goto(100, 50)
dot(10, 255, 0, 0)
goto(100, -50)
dot(10, 0, 255, 0)
goto(50, -50)
dot(10, 0, 0, 255)
goto(0,0)
done()
__________________________________________________________________________
Crear puntos de colores subiendo el lapiz (sin lineas)
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
colormode(255)

penup()
goto(100, 50)
dot(10, 255, 0, 0)
goto(100, -50)
dot(10, 0, 255, 0)
goto(50, -50)
dot(10, 0, 0, 255)
goto(0,0)
done()
__________________________________________________________________________
Rellenar figura
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(100, 0)
goto(100, 50)
goto(0, 50)
goto(0, 0)
end_fill()
done()
__________________________________________________________________________
Si no se establece color de relleno, el predeterminado es el negro.
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno predeterminado")
hideturtle()

pencolor("red")
pensize(5)
begin_fill()
goto(100, 0)
goto(100, 50)
goto(0, 50)
goto(0, 0)
end_fill()
done()
__________________________________________________________________________
Python rellena figuras aunque no estén completas.
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(100, 0)
goto(100, 50)
goto(0, 50)
end_fill()
done()
__________________________________________________________________________
Si las líneas de la figura se cruzan, Python rellena cada una de las partes cerradas.
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(50, 50)
goto(100, -50)
goto(150, 0)
goto(0, 0)
end_fill()
done()
__________________________________________________________________________
Otra figura con lineas cruzadas
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(0, 75)
goto(100, 0)
goto(100, 75)
end_fill()
done()
__________________________________________________________________________
Rectangulo
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(75, 0)
goto(75, 75)
penup()
goto(-100, 75)
pendown()
goto(-100,0)
goto(-25, 0)
end_fill()
done()
__________________________________________________________________________
Rellenar 2 figuras separadas
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("relleno")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(75, 0)
goto(75, 75)
end_fill()
penup()
goto(-100, 75)
pendown()
begin_fill()
goto(-100,0)
goto(-25, 0)
end_fill()
done()
__________________________________________________________________________
Se pueden llenar 2 figuras separadas si están cerradas.
from turtle import *

setup(450, 200, 0, 0)
screensize(300, 150)
title("www.mclibre.org")
hideturtle()

pensize(5)
fillcolor("red")
begin_fill()
goto(75, 0)
goto(75, 75)
goto(0,0)
penup()
goto(-100, 75)
pendown()
goto(-100,0)
goto(-25, 0)
goto(-100, 75)
end_fill()
done()