Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import tkinter as tk
- from tkinter import ttk
- """Formulario de ingreso de datos"""
- def saludar():
- global personas
- nombre = c_nombre.get()
- email = c_email.get()
- tel = c_tel.get()
- persona = {"nombre": nombre, "email":email, "tel":tel}
- personas.append(persona)
- for p in personas:
- for k,v in p.items():
- print(k,v)
- print()
- c_nombre.delete(0, tk.END)
- c_email.delete(0, tk.END)
- c_tel.delete(0, tk.END)
- ventana = tk.Tk()
- ventana.title("Mi primera app")
- ventana.config(width=400, height=800)
- personas = []
- # personas = [{"nombre": "Juan", "email":"j@mail.com", "tel":"15-252225"},
- # {"nombre": "Ana", "email":"jax@mail.com", "tel":"1556-252225"},
- # {"nombre": "Luv", "email":"ofj@mail.com", "tel":"15-2525985"},
- # ]
- ###### nombre ##########
- c_nombre = ttk.Entry()
- c_nombre.place(x=50, y=10)
- etiqueta = ttk.Label(text="Nombre")
- etiqueta.place(x=180, y=10)
- ###### email ##########
- c_email = ttk.Entry()
- c_email.place(x=50, y=50)
- etiqueta = ttk.Label(text="Email")
- etiqueta.place(x=180, y=50)
- ###### tel ##########
- c_tel = ttk.Entry()
- c_tel.place(x=50, y=90)
- etiqueta = ttk.Label(text="Tel")
- etiqueta.place(x=180, y=90)
- boton = ttk.Button(text="Guardar", command=saludar)
- boton.place(x=50, y=150, width=100, height=50)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement