Advertisement
teslariu

tlinter

Dec 16th, 2021
754
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import tkinter as tk
  5.  
  6. def guardar_datos():
  7.     nombre = caja.get()
  8.     print(f"El nombre ingresado es {nombre}")
  9.     # para borrar la caja:
  10.     caja.delete(0, tk.END)
  11.    
  12.    
  13.    
  14.  
  15. ventana = tk.Tk()
  16. ventana.title("Mi primera app")
  17. ventana.config(width=400, height=300, bg="green")
  18.  
  19. etiqueta = tk.Label(text="Nombre", bg="green", fg="white")
  20. etiqueta.place(x= 50, y=100)
  21.  
  22. caja = tk.Entry()
  23. caja.place(x=120, y=100)
  24.  
  25. boton = tk.Button(text="Guardar", command=guardar_datos)
  26. boton.place(x=100, y=180, width=100, height=40)
  27.  
  28. ventana.mainloop() 
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement