I want to read out an input from an input field in a GUI. My Problem is that my Code don't work if I use the grid() method for the order. If I use the pack() method it works... What I have to do, that the get() method also works in combination with the grid() method?
e.g. for work with pack()
from tkinter import *
def function1():
ci = e1.get()
print(c1)
window = Tk()
e1 = Entry(window)
b1 = Button(text="Ok", command=read_input_field)
e1.pack()
b1.pack()
window.mainloop()
e.g. for doesn't work with grid()
from tkinter import *
def function1():
ci = e1.get()
print(c1)
window = Tk()
e1 = Entry(window).grid(row=1, column=2)
b1 = Button(text="Ok", command=read_input_field).grid(row=1, column=2)
window.mainloop()
I hope you can help me.
A warm thank you in advance
tron