Python - Tkinter - i want get() value from Entry to use in function Python - Tkinter - i want get() value from Entry to use in function tkinter tkinter

Python - Tkinter - i want get() value from Entry to use in function


Perhaps you meant:

butt2 = Button(frame2,text="convert",command=lambda :convert(NbF.get())).grid(row=0,column=2)

This defers calling NbF.get() until the button is actually pressed. As the code was before, you were calling NbF.get() before the button was created and then passing that value to the function whenever you pressed the button.


As a side note, butt2 in the above code will always be None which is almost certainly not what you wanted it to be. The reason for this is because Widget.grid always returns None. I would advise you to not create a widget and pack/grid it on the same line -- always split that into 2 lines:

butt2 = Button(frame2,text="convert",command=lambda :convert(NbF.get()))butt2.grid(row=0,column=2)