I am a beginner to python and I am trying to create an if statement based on the dropdown box and I am not sure how to do it. My idea was if someone selects vertical from the dropdown the vertical_button() function will run and the same for horizontal. I have tried different methods and does not seem to work.
Any help would be much appreciated.
def horizontal_button():
SVV_bbh = Button(root,text = "Calculate system vapour volume", command=lambda:Horizontal_vessel_calc())
SVV_bbh.grid(row = 12, column = 1)
SVV_th = Label(root,text = "System Vapour Volume [Vg] =")
SVV_th.grid(row = 14, column = 0)
SVV_bh = Entry(root,bd=2,textvariable=h1)
SVV_bh.grid(row = 14, column = 1)
def vertical_button():
SVV_bbv = Button(root,text = "Calculate system vapour volume", command=lambda:vertical_vessel_calc())
SVV_bbv.grid(row = 12, column = 1)
SVV_tv = Label(root,text = "System Vapour Volume [Vg] =")
SVV_tv.grid(row = 14, column = 0)
SVV_bv = Entry(root,bd=2,textvariable=v1)
SVV_bv.grid(row = 14, column = 1)
clicked = StringVar()
options = ["Vertical","Horizontal"]
clicked.set("Vertical")
Orientation_t = Label(root, text = "Vessel Orientation")
Orientation_t.grid(row = 8, column = 0)
drop = OptionMenu(root,clicked, *options)
drop.grid(row = 8, column = 1)
Aucun commentaire:
Enregistrer un commentaire