Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import tkinter as tk
- ventana = tk.Tk()
- ventana.config(width=400, height=300, bg="DarkSeaGreen")
- ventana.title("Formulario de ingreso de datos")
- def clic():
- global personas
- persona = {}
- persona["nombre"] = caja_nombre.get()
- persona["email"] = caja_email.get()
- persona["telefono"] = caja_tel.get()
- personas.append(persona)
- print("\nDatos almacenados:")
- for persona in personas:
- print(persona)
- personas = []
- etiqueta = tk.Label(text="FORMULARIO")
- etiqueta.place(x=120, y=10)
- #### nombre #######
- etiqueta = tk.Label(text="Nombre:", bg="DarkSeaGreen")
- etiqueta.place(x=20, y=60)
- caja_nombre = tk.Entry(font=['arial',14,'italic'])
- caja_nombre.place(x=140, y=60, width=200, height=25)
- ### email #####
- etiqueta = tk.Label(text="Email:", bg="DarkSeaGreen")
- etiqueta.place(x=20, y=110)
- caja_email = tk.Entry(font=['arial',14,'italic'])
- caja_email.place(x=140, y=110, width=200, height=25)
- ### telefono #####
- etiqueta = tk.Label(text="TE:", bg="DarkSeaGreen")
- etiqueta.place(x=20, y=160)
- caja_tel = tk.Entry(font=['arial',14,'italic'])
- caja_tel.place(x=140, y=160, width=200, height=25)
- ######### boton ############
- boton = tk.Button(text="Guardar", command=clic)
- boton.place(x=150, y=200, width=100, height=30)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment