Advertisement
Enrro

Jared Tarbell (Cuadrados) 102233

Oct 22nd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. '''
  2. Created on 21/10/2014
  3. Circulos dentro de cuadrados monocromaticos
  4. Proven and tested on python 3.3.3
  5. @author: A01221672
  6. '''
  7.  
  8. from tkinter import *
  9. import random
  10.  
  11. ventana=Tk()
  12. largo = 400
  13. ancho = 400
  14.  
  15. lienzo=Canvas(ventana,width=largo,height=ancho)
  16. lienzo.pack()
  17.  
  18. def JaredTarbell(filas,columnas,randium):
  19. if randium == 0:
  20. lienzo.create_rectangle(0+filas,0+columnas,50+filas,50+columnas, outline = "black", fill = "black")
  21. lienzo.create_oval(5+filas,5+columnas,45+filas,45+columnas, outline ="white", fill = "white")
  22. if randium == 1:
  23. lienzo.create_rectangle(0+filas,0+columnas,50+filas,50+columnas, outline = "white", fill = "white")
  24. lienzo.create_oval(5+filas,5+columnas,45+filas,45+columnas, outline ="black", fill = "black")
  25. if randium == 2:
  26. prueba(filas,columnas,randium)
  27.  
  28.  
  29. def prueba(filas,columnas,randium):
  30. for filas in range(filas,filas+50,12):
  31. for lol in range(columnas,columnas+50,12):
  32. randium = random.randrange(0,2)
  33. print("columna " + str(filas)+ " fila " + str(columnas))
  34. if randium == 0:
  35. lienzo.create_rectangle(0+filas,0+lol,50*.25+filas,50*.25+lol, outline = "black", fill = "black")
  36. lienzo.create_oval(5*.25+filas,5*.25+lol,45*.25+filas,45*.25+lol, outline ="white", fill = "white")
  37. if randium == 1:
  38. lienzo.create_rectangle(0+filas,0+lol,50*.25+filas,50*.25+lol, outline = "white", fill = "white")
  39. lienzo.create_oval(5*.25+filas,5*.25+lol,45*.25+filas,45*.25+lol, outline ="black", fill = "black")
  40.  
  41.  
  42.  
  43.  
  44. for fil in range(0,largo,50):
  45. for col in range(0,ancho,50):
  46. aleatorios = random.randrange(0,3)
  47. JaredTarbell(fil,col,aleatorios)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement