Hi, I'm doing a program in tkinter that deals with a list to which you can add and remove what the user enters. For the user to add something, I need that when I press enter the information found in entry()"
is saved and a code is executed. How can I do it?
The Code:
import tkinter as tk
def agregar():
bA.place_forget()
bR.place_forget()
label = tk.Label(ventana, text = "Que desea agregar?", width = 31, fg = "black")
label.place(x = 40, y = 100)
var_e = tk.StringVar()
ent = tk.Entry(ventana, textvariable = var_e, width = 42, fg = "black")
ent.place(x = 20, y = 130)
def remover():
pass
ventana = tk.Tk()
ventana.title("Lista")
ventana.geometry('300x250')
var_L = tk.StringVar()
Lista = tk.Label(ventana, textvariable = var_L, width = 31, bg = "white", bd = 20)
Lista.place(x = 20, y = 32)
bA = tk.Button(ventana, text = "Agregar", width = 15, fg = "black", command = agregar)
bA.place(x = 20, y = 120)
bR = tk.Button(ventana, text = "Remover", width = 15, fg = "black", command = remover)
bR.place(x = 165, y = 120)
bS = tk.Button(ventana, text = "Salir", width = 7, fg = "black", command = quit)
bS.place(x = 120, y = 200)
ventana.mainloop()