In a onClick_button event I've a if condition to show a messagedialog if condition fails or else execute the rest of the statements. Basically if condition is checking whether a textctrl has value or not. If there is value execute the else statement.
this works for the first time with out any value in tc(textctrls) with a msgdlg, but when click ok on the dlg and add some value in the tc, still the msgdlg pops out when it should execute the else.
Your help is very appreciated. I've checked all the indentation.
def onClick_button_new(self, event):
self.list_box.Clear()
varstr = "csv"
if [(self.tc1.GetValue() == "") or (self.tc2.GetValue() == "")]:
dial = wx.MessageDialog(None, 'No file specified. Please specify relevant file', 'Error', wx.OK)
dial.ShowModal()
else:
file1 = subprocess.check_output("cut -d '.' -f2 <<< %s" %self.var1, shell = True, executable="bash")
file1type = file1.strip()
print file1type
file2 = subprocess.check_output("cut -d '.' -f2 <<< %s" %self.var2, shell = True, executable="bash")
file2type = file2.strip()
if varstr in (file1type, file2type):
print "yes"
else:
dial = wx.MessageDialog(None, ' Invalid file format. Please specify relevant file', 'Error', wx.OK)
dial.ShowModal()