在onClick_button事件我有一个if条件来显示messagedialog如果条件失败或执行其余的语句。 基本上,如果条件是检查textctrl是否有价值或不。如果有值执行else语句。蟒蛇如果条件不能正常工作如预期
这是第一次在tc(textctrls)中带有msgdlg的任何值,但是当在dlg上单击确定并在tc中添加一些值时,msgdlg仍然会在执行else时弹出。
非常感谢您的帮助。 我检查了所有的缩进。
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()
非常感谢。这工作。 –