teslariu

form

Feb 13th, 2021
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # formulario
  5. import tkinter as tk
  6. from tkinter import ttk
  7.  
  8. def guardar():
  9. datos = [nombre.get(), email.get(), pais.get()]
  10. print("Datos guardados:", datos)
  11.  
  12.  
  13.  
  14. ventana = tk.Tk()
  15. ventana.title("Formulario")
  16. ventana.config(width=400, height=800)
  17.  
  18.  
  19. label = ttk.Label(text="FORMULARIO")
  20. label.place(x=120, y=10)
  21.  
  22.  
  23. ##### campo nombre #################
  24. nombre = ttk.Entry()
  25. nombre.place(x=120, y=70)
  26. label = ttk.Label(text="Nombre")
  27. label.place(x=10, y=70)
  28.  
  29.  
  30. ###### campo email ###############
  31. email = ttk.Entry()
  32. email.place(x=120, y=120)
  33. label = ttk.Label(text="Email")
  34. label.place(x=10, y=120)
  35.  
  36. ###### campo nacionalidad ###########
  37. pais = ttk.Entry()
  38. pais.place(x=120, y=170)
  39. label = ttk.Label(text="Nacionalidad")
  40. label.place(x=10, y=170)
  41.  
  42.  
  43. boton = ttk.Button(text="Guardar datos", command=guardar)
  44. boton.place(x=90, y=220)
  45.  
  46.  
  47.  
  48.  
  49.  
  50. ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment