MATERIAS DEL BLOG

miércoles, 23 de mayo de 2018

MI FIGURA EN 2D EN PYTHON UTILIZANDO CANVAS

CAPTURA

CODIGO

       
from Tkinter import *
canvas = Canvas(width=600, height=600, bg='white')
canvas.create_polygon(300, 10,270,60,270,60,330,60, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(270, 70,330,70,330,70,300,120, fill='aqua',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(260, 70,290,120,290,120,230,120, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(310,120,370,120,370,120,340,70, fill='cornflowerblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(230,130,290,130,290,130,260,180, fill='aquamarine',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(310,130,370,130,370,130,340,180, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(220,130,250,180,250,180,190,180, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(380,130,350,180,350,180,410,180, fill='paleturquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(190,190,250,190,250,190,220,240, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(190,190,250,190,250,190,220,240, fill='lightblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(180,190,210,240,210,240,150,240, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(350,190,410,190,410,190,380,240, fill='cornflowerblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(420,190,390,240,390,240,450,240, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(150,250,210,250,210,250,180,300, fill='darkcyan',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(390,250,450,250,450,250,420,300, fill='powderblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(140,250,110,300,110,300,170,300, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(460,250,490,300,490,300,430,300, fill='royalblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(110,310,170,310,170,310,140,360, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(430,310,490,310,490,310,460,360, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(100,310,130,360,130,360,70,360, fill='skyblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(70,370,130,370,130,370,100,420, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(60,370,90,420,90,420,30,420, fill='powderblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(110,420,170,420,170,420,140,370, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(190,420,250,420,250,420,220,370, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(270,420,330,420,330,420,300,370, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(350,420,410,420,410,420,380,370, fill='deepskyblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(430,420,490,420,490,420,460,370, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(510,420,570,420,570,420,540,370, fill='powderblue',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(150,370,210,370,210,370,180,420, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(230,370,290,370,290,370,260,420, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(310,370,370,370,370,370,340,420, fill='paleturquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(390,370,450,370,450,370,420,420, fill='mediumturquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(470,370,530,370,530,370,500,420, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)

canvas.create_polygon(530,360,470,360,470,360,500,310, fill='turquoise',outline='black', dash=(5, 10))
canvas.pack(expand=YES, fill=BOTH)


mainloop()

       

No hay comentarios:

Publicar un comentario

FIGURA 3D EN PYTHON

import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * verticies = ( (1, -1, -1), (1...