I have been trying to make a user interface (by using tkinter)in Python that saves the number you enter. In this case I want the user to be able to give a start value and an end value of a measurement, which afterwards will be implemented in a code. For this to work, I need the user interface to be able to store the values I enter. However, so far I haven't be able to export my variables with the assigned values. I only managed to get the variables with value 0. Could someone please help me figure out my mistake? Thanks in advance!
Here is the code I used:
import tkinter as tk
import tkinter.messagebox
root = tk.Tk()
tk.Label(root, text = "Start of measurement (index): ")
tk.Label(root, text = "End of measurement (index): ")
def add_text():
label1 = tk.Label(root, text="You have entered the start and end index of the measurement")
label1.pack()
Start = tk.DoubleVar(root)
End = tk.DoubleVar(root)
Start_measurement = Start.get()
End_measurement = End.get()
Start_label = tk.Label(root, text="Start of measurement (index): ")
Start_label.pack()
Start_text_box = tk.Entry(root, bd=1)
Start_text_box.pack()
End_label = tk.Label(root, text="End of measurement (index): ")
End_label.pack()
End_text_box = tk.Entry(root, bd=1)
End_text_box.pack()
enter_button = tk.Button(root, text="Enter", command=add_text)
enter_button.pack()
root.mainloop()