Introducción a Tkinter en Python
Introducción a Tkinter en Python
# Python 2.x
import Tkinter as tk
# Python 3.x
import tkinter as tk
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
Geometry Events
Widgets
Managers and Binds
place <Button>
button
grid <Motion>
canvas
pack <ButtonRelease>
checkbutton
combobox <Double-Button>
Entry <Enter>
... ...
top = [Link]()
[Link]("Titulo ventana")
# [Link]("200x100")
[Link]()
top = [Link]()
[Link]("Titulo ventana")
[Link]("200x50")
frame1 = [Link](top)
[Link](column=0,row=0)
[Link]()
Bibliotecas gráficas Algoritmos y Programación 6
Ejemplos
# -*- coding: utf-8 -*-
import tkinter as tk
top = [Link]()
[Link]("Titulo ventana")
[Link]("200x50")
frame1 = [Link](top)
[Link](column=0,row=0)
v1 = [Link](frame1,value='10')
edit1 = [Link](frame1, textvariable = v1)
[Link](column=1,row=0)
[Link]()
Bibliotecas gráficas Algoritmos y Programación 7
# -*- coding: utf-8 -*-
Ejemplos
import tkinter as tk
def accion_boton1():
print("Datos en Entry: "+[Link]())
top = [Link]()
[Link]("Titulo ventana")
[Link]("280x50")
frame1 = [Link](top)
[Link](column=0,row=0)
v1 = [Link](frame1,value='10')
edit1 = [Link](frame1, textvariable = v1)
[Link](column=1,row=0)
print(v1)
[Link]()
Bibliotecas gráficas Algoritmos y Programación 8
Otros Widgets
Tk provides the following widgets:
●
button
●
canvas
●
checkbutton
●
combobox
●
entry
●
frame
●
label
●
…
[Link]