Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # place
- import tkinter as tk
- from tkinter import ttk
- def guardar():
- global personas
- nombre = caja_nombre.get()
- email = caja_email.get()
- tel = caja_tel.get()
- persona = {"nombre":nombre, "email":email, "tel":tel}
- personas.append(persona)
- # imprimo los datos
- for persona in personas:
- print(persona)
- # borro el formulario
- caja_nombre.delete(0,tk.END)
- caja_email.delete(0,tk.END)
- caja_tel.delete(0,tk.END)
- """
- personas = [
- {"nombre": "Ale", "email":"ale@ale.com", "tel":45646554},
- {"nombre": "Juan", "email":"ad@ale.com", "tel":45646554},
- {"nombre": "Oscar", "email":"dsafdf@ale.com", "tel":898846554},
- {"nombre": "Ana", "email":"dsfdsf@ale.com", "tel":45646554},
- ]
- """
- personas = []
- ventana = tk.Tk()
- ventana.title("Posicionamiento place")
- ventana.config(width=400, height=800)
- # ventana.resizable(0,0) impide modificar el tamaño de la ventana
- #### campos de un formulario ###################
- ## nombre
- etiqueta = ttk.Label(text="Nombre")
- etiqueta.place(x=20, y=20)
- caja_nombre = ttk.Entry()
- caja_nombre.place(x=100, y=20, width=200, height=25)
- ## email
- etiqueta = ttk.Label(text="email")
- etiqueta.place(x=20, y=70)
- caja_email = ttk.Entry()
- caja_email.place(x=100, y=70, width=200, height=25)
- ## tel
- etiqueta = ttk.Label(text="Teléfono")
- etiqueta.place(x=20, y=120)
- caja_tel = ttk.Entry()
- caja_tel.place(x=100, y=120, width=200, height=25)
- ## boton
- boton = ttk.Button(text="Guardar", command=guardar)
- boton.place(x=150, y=170, width=100, height=40)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement