Entradas

Mostrando entradas de octubre, 2017

Python gráficos 3D

Phython-blender http://piziadas.com/2015/10/programando-con-python-en-blender.html Libreria Matplotlib http://webs.ucm.es/info/aocg/python/modulos_cientificos/matplotlib/index.html http://programacion.net/articulo/introduccion_a_la_libreria_matplotlib_de_python_1599 Tutorial de Matplotlib https://pybonacci.org/wp-content/uploads/2012/08/tutorial-de-matplotlib-pyplotv0-1-201208311.pdf

La niña y la pinta(?

from turtle import * setup( 500 , 500 , 200 , 200 ) title( 'Barquito' ) penup() hideturtle() fillcolor( 'brown' ) begin_fill() goto( 15 , 20 ) pendown() goto( 25 , 5 ) goto( 55 , 5 ) goto( 65 , 20 ) goto( 15 , 20 ) end_fill() penup() goto( 40 , 20 ) pendown() goto( 40 , 55 ) fillcolor( 'aquamarine' ) begin_fill() goto( 25 , 25 ) goto( 40 , 55 ) goto( 55 , 25 ) goto( 25 , 25 ) end_fill() penup() goto(- 40 , 5 ) pendown() fillcolor( 'brown' ) begin_fill() goto(- 10 , 5 ) goto(- 5 , 15 ) goto(- 45 , 15 ) goto(- 40 , 5 ) end_fill() penup() goto(- 25 , 15 ) pendown() goto(- 25 , 40 ) fillcolor( 'aquamarine' ) begin_fill() goto(- 35 , 20 ) goto(- 15 , 20 ) goto(- 25 , 40 ) end_fill() done()

Pinito

from turtle import * setup( 450 , 500 , 0 , 0 ) screensize( 300 , 150 ) title( "www.mclibre.org" ) hideturtle() pensize( 1 ) fillcolor( "green" ) begin_fill() goto(- 20 , 0 ) goto( 20 , 0 ) goto( 0 , 20 ) goto(- 20 , 0 ) penup() goto( 0 ,- 0 ) pendown() goto(- 40 ,- 20 ) goto( 40 ,- 20 ) goto( 0 , 0 ) penup() goto( 0 ,- 20 ) pendown() goto(- 60 ,- 40 ) goto( 60 ,- 40 ) goto( 0 ,- 20 ) end_fill() penup() goto(- 10 ,- 40 ) pendown() fillcolor( "brown" ) begin_fill() goto(- 10 ,- 55 ) goto( 10 ,- 55 ) goto( 10 ,- 40 ) end_fill() done()

Morido x.x

from turtle import * setup( 500 , 400 , 100 , 100 ) title( 'OwO' ) colormode( 255 ) pencolor( 'black' ) pensize( 10 ) goto( 0 , 150 ) goto( 80 , 150 ) goto( 80 , 120 ) penup() goto( 50 , 0 ) pendown() goto(- 50 , 0 ) penup() goto( 80 , 120 ) pendown() pensize( 20 ) dot( 'black' ) pensize( 9 ) goto( 80 , 35 ) goto( 60 , 25 ) penup() goto( 80 , 80 ) pendown() goto( 60 , 60 ) penup() goto( 80 , 80 ) pendown() goto( 100 , 60 ) penup() goto( 80 , 35 ) pendown() goto( 100 , 25 ) pensize( 3 ) penup() hideturtle() goto( 70 , 122 ) pendown() pencolor( 'white' ) goto( 75 , 112 ) penup() goto( 75 , 122 ) pendown() goto( 70 , 112 ) penup() goto( 90 , 122 ) pendown() goto( 85 , 112 ) penup() goto( 85 , 122 ) pendown() goto( 90 , 112 ) penup() goto(- 400 , - 5 ) pendown() pencolor( 'black' ) fillcolor( "pink" ) begin_fill() goto( 400 ,- 5 ) goto( 400 ,- 200 ) goto(- 400 ,- 200 ) goto(- 400 ,- 5 ) end_fill() done()

Figuras con if

# -*- coding: utf-8 -*- from Tkinter import * v0 = Tk() v0.title("OwO") v0.config(bg="aquamarine") v0.geometry("450x200") def mostrar(num): v1 = Toplevel(v0) v1.title("Ventana hija") v1.protocol("WM_DELETE_WINDOW", "onexit") v1.config(bg="black") v1.geometry("300x300") if num==1: hola = Canvas(v1, width=400, heigh=400, bg='pink') hola.pack(expand=YES, fill=BOTH) hola.create_oval(10, 10, 200, 200, width=5, fill='gray') b3 = Button(hola, text="ocultar", command=lambda: ejecutar(ocultar(v1))) b3.pack() elif num == 2: canvas = Canvas(v1,width=300, height=210, bg='blue') canvas.pack(expand=YES, fill=BOTH) canvas.create_rectangle(10, 10, 200, 200, width=5, fill='red') b3 = Button(canvas, text="ocultar", command=lambda: ejecutar(ocultar(v1))) b3.pack() elif num == 3: canvas2 = Canvas(v1,width=300, height=210, bg='gray') canvas2.p

Todas las figuras

from Tkinter import * # -*- coding: utf-8 -*-from tkinter import * VentanaPrincipal = Tk() VH = Toplevel(VentanaPrincipal) VH2 = Toplevel(VentanaPrincipal) VH3 = Toplevel(VentanaPrincipal) VH4 = Toplevel(VentanaPrincipal) VH5 = Toplevel(VentanaPrincipal) VH6 = Toplevel(VentanaPrincipal) VH7 = Toplevel(VentanaPrincipal) VH8 = Toplevel(VentanaPrincipal) VH9 = Toplevel(VentanaPrincipal) VH10 = Toplevel(VentanaPrincipal) VH11 = Toplevel(VentanaPrincipal) VH12 = Toplevel(VentanaPrincipal) VH13 = Toplevel(VentanaPrincipal) VH14 = Toplevel(VentanaPrincipal) VH15 = Toplevel(VentanaPrincipal) VH16 = Toplevel(VentanaPrincipal) VH17 = Toplevel(VentanaPrincipal) def mostrar(ventana): ventana.deiconify() def ocultar(ventana): ventana.withdraw() def ejecutar(f): VentanaPrincipal.after(200, f) VentanaPrincipal.config(bg="green") VentanaPrincipal.geometry("1920x1080") def Circulo(ventana):     VH.deiconify()     Circulo = Canvas(VH, width=210,