import tkinter as tk from tkinter.constants import * COUNT = 10 def get_values(widget, table): for k in range(COUNT): a = "%d.0" % (k + 2) v = widget.get(a,a+'lineend') if not v: break print ('a: %s, v: %s' % (a, v)) table[k]=float(v) # ----- Programme principale ---- if __name__ == '__main__': table = [0.0] * COUNT main = tk.Tk() main.title ("Calcul des niveaux d’énergies") text = tk.Text(main) text.insert(INSERT,"Rentrer les valeurs des paramètres") text.pack() tk.Button(main, text='Quitter',command=main.quit).pack() tk.Button(main, text="Acquisition des paramètres",command=lambda: get_values(text, table)).pack() tk.mainloop() print ('table:\n%s' % '\n'.join(str(f) for f in table))