Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # formulario
- import tkinter as tk
- from tkinter import ttk
- def guardar():
- datos = [nombre.get(), email.get(), pais.get()]
- print("Datos guardados:", datos)
- ventana = tk.Tk()
- ventana.title("Formulario")
- ventana.config(width=400, height=800)
- label = ttk.Label(text="FORMULARIO")
- label.place(x=120, y=10)
- ##### campo nombre #################
- nombre = ttk.Entry()
- nombre.place(x=120, y=70)
- label = ttk.Label(text="Nombre")
- label.place(x=10, y=70)
- ###### campo email ###############
- email = ttk.Entry()
- email.place(x=120, y=120)
- label = ttk.Label(text="Email")
- label.place(x=10, y=120)
- ###### campo nacionalidad ###########
- pais = ttk.Entry()
- pais.place(x=120, y=170)
- label = ttk.Label(text="Nacionalidad")
- label.place(x=10, y=170)
- boton = ttk.Button(text="Guardar datos", command=guardar)
- boton.place(x=90, y=220)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment