Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Formulario de ingreso de datos
- """
- import tkinter as tk
- def guardar():
- global lista_usuarios
- nombre = caja_nombre.get()
- email = caja_email.get()
- nacimiento = caja_nacimiento.get()
- telefono = caja_telefono.get()
- usuario = {"nombre":nombre,"email":email,"nacimiento":nacimiento,"telefono":telefono}
- lista_usuarios.append(usuario)
- for persona in lista_usuarios:
- for k,v in persona.items():
- print(k,v)
- print()
- ###### programa principal #############################
- lista_usuarios = [] # lista_usuarios=[{usuario1}, {usuario2}, {usuarioN}]
- ventana = tk.Tk()
- ventana.config(width=400, height=300, bg="light steel blue")
- ventana.title("Formulario de registro")
- ### campo de nombre ######
- caja_nombre = tk.Entry()
- caja_nombre.place(x=125, y=30, width=150, height=25)
- etiqueta = tk.Label(text="Nombre y Apellido" ,bg="light steel blue")
- etiqueta.place(x=15, y=30)
- ### campo de email ######
- caja_email = tk.Entry()
- caja_email.place(x=125, y=70, width=150, height=25)
- etiqueta = tk.Label(text="Email" ,bg="light steel blue")
- etiqueta.place(x=15, y=70)
- ### campo de te ######
- caja_telefono = tk.Entry()
- caja_telefono.place(x=125, y=110, width=150, height=25)
- etiqueta = tk.Label(text="TEL" ,bg="light steel blue")
- etiqueta.place(x=15, y=110)
- ### campo de nacimiento ######
- caja_nacimiento = tk.Entry()
- caja_nacimiento.place(x=125, y=150, width=150, height=25)
- etiqueta = tk.Label(text="Fecha nacimiento" ,bg="light steel blue")
- etiqueta.place(x=15, y=150)
- ##### botón ########
- boton = tk.Button(text="GUARDAR DATOS", command=guardar)
- boton.place(x=140, y=200, width=120, height=30)
- ventana.mainloop()
Advertisement
RAW Paste Data
Copied
Advertisement