martes, 31 de octubre de 2017
martes, 24 de octubre de 2017
Figura en python
from turtle import* import tkSimpleDialog speed(20) shape("turtle") setup(1000, 700, 0, 0) screensize(1000,1000) #Cuadros de dialogos que piden datosa=tkSimpleDialog.askstring("Hola!","Dame color del fondo") b=tkSimpleDialog.askstring("Hola!","dame el principal color") d=tkSimpleDialog.askstring("Hola!","dame el color 1") e=tkSimpleDialog.askstring("Hola!","dame el color 2") f=tkSimpleDialog.askstring("Hola!","dame el color 3") g=tkSimpleDialog.askstring("Hola!","dame el color 4") h=tkSimpleDialog.askstring("Hola!","dame el color 5") vueltas= tkSimpleDialog.askinteger("Numero de figuras","Dame el num. de figuras") pincel= tkSimpleDialog.askinteger("Numero de pixeles","Grosor de la pluma") bgcolor(a) pensize(pincel) fillcolor(b) begin_fill() cont=0for i in range(vueltas): if cont ==1: fillcolor(d) elif cont==2: fillcolor(e) elif cont==3: fillcolor(f) elif cont==4: fillcolor(g) elif cont==5: fillcolor(h) begin_fill() penup() goto(250.55432, -493.03935) pendown() goto(278.9908, -463.18105) goto(325.911, -453.22828) goto(367.14389, -441.85369) goto(404.11132, -420.52633) goto(429.70415, -396.35532) goto(446.76604, -363.65337) goto(459.56246, -330.95141) goto(463.82793, -305.35858) goto(460.98428, -274.07845) goto(480.88982, -241.3765) goto(458.14063, -214.36184) goto(441.07874, -178.81624) goto(431.12598, -137.58334) goto(435.39145, -102.03774) goto(449.60969, -69.33579) goto(466.67158, -49.43025) goto(446.76604, -22.41559) goto(418.32956, -35.21201) goto(385.62761, -33.79019) goto(350.082, -23.83742) goto(325.911, -6.77553) goto(290.36539, -26.68106) goto(250.55432, -38.05566) goto(210.74325, -30.94654) goto(178.04129, -8.19735) goto(151.02664, -25.25924) goto(119.74651, -33.79019) goto(88.46638, -33.79019) goto(57.18625, -23.83742) goto(34.43706, -46.5866) goto(57.18625, -83.55403) goto(65.71719, -113.41233) goto(67.13902, -146.11429) goto(55.76443, -185.92536) goto(40.12436, -217.20549) goto(13.1097, -242.79832) goto(38.70254, -271.2348) goto(35.85889, -302.51493) goto(40.12436, -336.63871) goto(54.3426, -369.34066) goto(75.66996, -403.46444) goto(101.26279, -424.7918) goto(133.96475, -441.85369) goto(175.19765, -457.49375) goto(215.00872, -464.60287) goto(250.55432, -493.03935) end_fill() cont = cont+1 print vueltas exitonclick()
miércoles, 18 de octubre de 2017
Preguntar el color con SimpleDialog
import turtle import tkSimpleDialog t=turtle.Turtle() c1=tkSimpleDialog.askstring("Color","Escribe el color del lapiz:") c2=tkSimpleDialog.askstring("Color","Escribe el color del relleno:") t.color(c1, c2) t.begin_fill() for _ in xrange(3): t.fd(100) t.left(120) t.end_fill() turtle.done()
Figuras Con For Anidado
Cuadrado con for anidado
import turtle turtle.speed(10) fondo=turtle.Screen() fondo.bgcolor("#0000FF") turtle.pencolor("black") for i in range(28): turtle.forward(100) turtle.right(90) for j in range(1): turtle.forward(100) turtle.right(80) turtle.exitonclick()Triangulo con for anidadoimport turtle turtle.speed(10) fondo=turtle.Screen() fondo.bgcolor("#0000FF") turtle.pencolor("black") for i in range(28): turtle.forward(100) turtle.right(120) for j in range(1): turtle.forward(100) turtle.right(100) turtle.exitonclick()
Octagono con for anidadoimport turtle turtle.speed(10) fondo=turtle.Screen() fondo.bgcolor("#0000FF") turtle.pencolor("black") for i in range(28): turtle.forward(100) turtle.right(45) for j in range(1): turtle.forward(100) turtle.right(40) turtle.exitonclick()
jueves, 5 de octubre de 2017
Turtle
Programa 1
from turtle import * setup(640, 480, 0, 0) done()Programa 2
from turtle import * setup(450, 150, 0, 0) title("Ejemplo de ventana") done()Programa 3
from turtle import * title("Ejemplo de ventana") done()Programa 4
from turtle import * setup(250, 100, 0, 0) title("Ejemplo de ventana") hideturtle() dot(10, 0, 0, 0) setup(450, 150, 0, 0) done()Programa 5
from turtle import * setup(450, 150, 0, 0) screensize(10, 10) done()Programa 6
from turtle import * setup(150, 150, 0, 0) screensize(300, 300) done()Programa 7
from turtle import * setup(450, 150, 0, 0) screensize(400, 300) done()Programa 8
from turtle import * setup(250, 100, 0, 0) screensize(100, 100) hideturtle() dot(10, 0, 0, 0) screensize(200, 100) done()Programa 9
from turtle import * setup(450, 150, 0, 0) screensize(300, 150) showturtle() done()Programa 10
from turtle import * setup(450, 150, 0, 0) screensize(300, 150) goto(100, 0) done()Programa 11
from turtle import * setup(450, 150, 0, 0) screensize(300, 150) goto(100, 0) hideturtle() done()Programa 12
from turtle import * setup(450, 150, 0, 0) screensize(300, 150) hideturtle() goto(100, 0) done()Programa 13
from turtle import * setup(450, 200, 0, 0) screensize(300, 150) goto(0, 0) done()Programa 14
from turtle import * setup(450, 200, 0, 0) screensize(300, 150) goto(100, 50) done()Programa 15
from turtle import * setup(450, 200, 0, 0) screensize(300, 150) goto(100, 50) goto(100, -50) goto(50, -50) done()Programa 16from turtle import * setup(450, 200, 0, 0) screensize(300, 150) title("www.mclibre.org") hideturtle() pensize(5) fillcolor("red") begin_fill() goto(100, 0) goto(100, 50) goto(0, 50) goto(0, 0) end_fill() done()Programa 17
Programa 18from turtle import * setup(450, 200, 0, 0) screensize(300, 150) title("www.mclibre.org") hideturtle() pencolor("red") pensize(5) begin_fill() goto(100, 0) goto(100, 50) goto(0, 50) goto(0, 0) end_fill() done()
from turtle import * setup(450, 200, 0, 0) screensize(300, 150) title("www.mclibre.org") hideturtle() pensize(5) fillcolor("red") begin_fill() goto(100, 0) goto(100, 50) goto(0, 50) end_fill() done()Programa 19
from turtle import * setup(450, 200, 0, 0) screensize(300, 150) title("www.mclibre.org") hideturtle() pensize(5) fillcolor("red") begin_fill() goto(50, 50) goto(100, -50) goto(150, 0) goto(0, 0) end_fill() done()Programa 20
from turtle import * setup(450, 200, 0, 0) screensize(300, 150) title("www.mclibre.org") hideturtle() pensize(5) fillcolor("red") begin_fill() goto(0, 75) goto(100, 0) goto(100, 75) end_fill() done()Programa 21
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) penup() goto(-100, 75) pendown() goto(-100,0) goto(-25, 0) end_fill() done()Programa 22
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) end_fill() penup() goto(-100, 75) pendown() begin_fill() goto(-100,0) goto(-25, 0) end_fill() done()Programa 23
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()
Suscribirse a:
Entradas (Atom)














