Advertisement
teslariu

graf

Jun 10th, 2021
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.92 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #import math as m
  5. # raiz = m.sqrt(23)
  6. #print(raiz))
  7.  
  8. import tkinter as tk
  9.  
  10. def clic():
  11.     datos = []
  12.     datos.append(caja_nombre.get())
  13.     datos.append(caja_apellido.get())
  14.     datos.append(caja_mail.get())
  15.     datos.append(caja_tel.get())
  16.     datos.append(caja_dir.get())
  17.     datos.append(caja_nac.get())
  18.     print("Se han guardado los datos:")
  19.     for dato in datos:
  20.         print(dato, end= " ")
  21.  
  22.  
  23. ventana = tk.Tk()
  24. ventana.config(width=400, height=350, bg="cadet blue")
  25. ventana.title("FORMULARIO")
  26. ventana.resizable(0,0)
  27.  
  28. ##################  FORMULARIO  ########################
  29.  
  30. ####  campo nombre  #####
  31. caja_nombre = tk.Entry()
  32. caja_nombre.place(x=120, y=20, width=200, height=25)
  33. etiqueta = tk.Label(text="Nombre", bg="cadet blue")
  34. etiqueta.place(x=20, y=20)
  35.  
  36. ####  campo apellido  #####
  37. caja_apellido = tk.Entry()
  38. caja_apellido.place(x=120, y=60, width=200, height=25)
  39. etiqueta = tk.Label(text="Apellido", bg="cadet blue")
  40. etiqueta.place(x=20, y=60)
  41.  
  42. ####  campo mail  #####
  43. caja_mail = tk.Entry()
  44. caja_mail.place(x=120, y=110, width=200, height=25)
  45. etiqueta = tk.Label(text="email", bg="cadet blue")
  46. etiqueta.place(x=20, y=110)
  47.  
  48. ####  campo telefono  #####
  49. caja_tel = tk.Entry()
  50. caja_tel.place(x=120, y=160, width=200, height=25)
  51. etiqueta = tk.Label(text="Teléfono", bg="cadet blue")
  52. etiqueta.place(x=20, y=160)
  53.  
  54. ####  campo direccion  #####
  55. caja_dir = tk.Entry()
  56. caja_dir.place(x=120, y=210, width=200, height=25)
  57. etiqueta = tk.Label(text="Dirección", bg="cadet blue")
  58. etiqueta.place(x=20, y=210)
  59.  
  60. ####  campo nacionalidad  #####
  61. caja_nac = tk.Entry()
  62. caja_nac.place(x=120, y=260, width=200, height=25)
  63. etiqueta = tk.Label(text="Nacionalidad", bg="cadet blue")
  64. etiqueta.place(x=20, y=260)
  65.  
  66.  
  67. #### Botón del formulario
  68. boton = tk.Button(text="GUARDAR", command=clic)
  69. boton.place(x=180, y=300, width=80, height=35)
  70.  
  71. ventana.mainloop()
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement