Curso de Programación en Python/Input-9
Ir a la navegación
Ir a la búsqueda
Input-9.py
#!/usr/bin/python3
#-*-coding: utf-8 -*-
import tkinter as tk
class Application( tk.Frame ):
def __init__( self, master=None ):
tk.Frame.__init__( self, master )
self.pack()
self.createWidgets()
def createWidgets( self ):
self.hi_there = tk.Button( self )
self.hi_there["text"] = "Hola Mundo\n( Da click aquí )"
self.hi_there["command"] = self.say_hi
self.hi_there.pack( side="top" )
self.QUIT = tk.Button( self, text="Terminar", fg="red",
command=root.destroy )
self.QUIT.pack( side="bottom" )
def say_hi( self ):
print( "Saludos a todos!" )
root = tk.Tk()
app = Application( master=root )
app.mainloop()