Jan-29-2023, 06:17 PM
Hello. I'm just learning Python. I have confronted a problem in my study.
I have an optionlist for building types (Residential, Museum, Hospital, Hotel etc.) but I need to convert these building types into numbers (fire load 'MJ/kg').
In other words, I want each building type to have its own "Numerical data of fire load".
For example, I would like "Museum" to appear in the option list, but when I select the museum, "100" should be written in the relevant entry.
How can it be done? Thank you in advance.
I have an optionlist for building types (Residential, Museum, Hospital, Hotel etc.) but I need to convert these building types into numbers (fire load 'MJ/kg').
In other words, I want each building type to have its own "Numerical data of fire load".
For example, I would like "Museum" to appear in the option list, but when I select the museum, "100" should be written in the relevant entry.
How can it be done? Thank you in advance.

options_list = {"Museum": 100, "School": 200, "Library": 300, "House": 400, "Bath": 500} value_inside = tkinter.StringVar(Variable) value_inside.set("Pick a Building Type") question_menu = tkinter.OptionMenu(window, value_inside, *options_list) question_menu.place(x=395, y=253) building_types = tkinter.Entry(window, textvariable=value_inside, state=NORMAL, bd=5, fg='black', font=("Helvetica", 12, BOLD)) building_types.place(x=292, y=255, width=100, height=30)