-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python2.6 | ||
#_*_coding:utf8_*_ | ||
|
||
|
||
"Este es un programa basico que crea una ventana con las librerias Tkinter" | ||
|
||
#llamo al modulo Tkinter | ||
import Tkinter as Tki | ||
|
||
#Creo una ventana | ||
ventana = Tki.Tk() | ||
|
||
|
||
#Creo el lienzo y defino el ancho y el largo de la ventana en pixeles | ||
#Ancho | ||
W = 500 | ||
#Altura | ||
H = 500 | ||
lienzo = Tki.Canvas(ventana, width= W, height= H) | ||
lienzo.pack() | ||
|
||
|
||
#Dibujo una elipse | ||
x0 = 100 | ||
y0 = 100 | ||
x1 = 150 | ||
y1 = 150 | ||
lienzo.create_oval(x0,y0,x1,y1, fill = "blue", tag = "pelota") | ||
lienzo.create_rectangle(x0+5,y0-5,x1+5,y1-5, fill = "white", tag = "cuadrado") | ||
|
||
|
||
deltax = 1 | ||
deltay = 1 | ||
alto = True | ||
while alto: | ||
lienzo.move("pelota", deltax, deltay) | ||
xx0,yy0,xx1,yy1= lienzo.bbox("pelota") | ||
if(yy1>=H): | ||
alto = False | ||
print xx0,yy0,xx1,yy1 | ||
lienzo.after(100) | ||
lienzo.update() | ||
|
||
|
||
|
||
#Esto es necesario para dibujar la ventana | ||
ventana.mainloop() |