'combobox get() with if statemnt GUI TKINTER python
I am not sure how to apply the if statement with 3 different combobox within Python class with different defining functions (after building the GUI) so when you press the bottom you connected with different defining fucntion.
as shown below :
class Toplevel1:
def __init__(self, top=None):
'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
.
.
.
def supercell_generation(e):
if self.TCombobox1_1.get() == "Au":
self.TCombobox1_2.get() == "32"
self.TCombobox1_3.conf() == "Cubic Closed Packed":
self.Generate(command = supercell_3())
if not self.TCombobox1_2.get() == "64"
self.TCombobox1_3.conf() == "FCC":
self.Generate(command = supercell_4())
button.pack()
root = Tk()
app = Toplevel1(root)
root.wm_title("Supercell")
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|