Practica #9: abrir un archivo gif

# Aportacion.- Alan Hernandez Mijangos
# Programa.- que toma un archivo GIF y lo muestra al hacer clic en un boton
# -*- coding: utf-8 -*-import Tkinter as tk
from Tkinter import *

ventana = Tk()
ventana.geometry('400x400')
ventana.config(bg="black")
ventana.title("Mostrando y ocultando un boton con una imagen")


def btn_hide():
    if b1.winfo_ismapped():
        b1.place_forget()
        b2.configure(text="Mostrar carita", width=15)
    else:
        b1.place(x=70, y=50)
        b2.configure(text="Ocultar carita", width=15)


imgBoton = PhotoImage(file="jack.gif")
b1 = Button(ventana, text="Boton 1", image=imgBoton, fg="black", width=200)
b1.place(x=90, y=50)
b2 = Button(ventana, text="Ocultar carita", command=btn_hide, fg="black", width=15)
b2.place(x=130, y=280)

ventana.mainloop()



Comentarios

Entradas populares