Hi guys i'm making a Temperature Converter based on Tkinter in Python and it was all good but now i'm getting this error. I looked here on stackoverflow for this error, i found a lot of them but i couldn't figured out, so i'm here to post my code to see if you guys can help. The program crashes exactly when i click a option on the OptionMenu. (om_input specifically)
Here is the error:
Traceback (most recent call last):
TypeError: 'NoneType' object is not callable
It throws another exception:
AttributeError: 'StringVar' object has no attribute '_report_exception'
Here are snippets of my code:
This function is supposed to be called everytime the user selects an option in the OptionMenu in the GUI.
def check_entry():
if temperature_input.get() == "Celsius":
celsius_converter(value_entry.get(), temperature_output.get(), output_entry)
elif temperature_input.get() == "Kelvin":
kelvin_converter(value_entry.get(), temperature_output.get(), output_entry)
else:
fahrenheit_converter(value_entry.get(), temperature_output.get(), output_entry)
The vars to be used with the OptionMenus
root = Tk()
temperature_list = ["Celsius", "Kelvin", "Fahrenheit"]
temperature_input = StringVar(root)
temperature_input.set(temperature_list[0])
temperature_output = StringVar(root)
temperature_output.set(temperature_list[0])
output_entry = Entry(root, state=NORMAL)
Initialization of the OptionMenus
om_input = OptionMenu(root, temperature_input, *temperature_list, command=check_entry)
om_output = OptionMenu(root, temperature_output, *temperature_list, command=check_entry)
root.mainloop()
File "myfile.py", line 9and such before the actual error message. Did you cut anything out?