我正在编写一个程序,以便可以通过电子邮件和使用 wxpython 发送短信。使用组合框选择电话号码附加到的运营商。但是,在我有机会选择运营商之前,该计划会继续进行其他所有操作。在我做出选择之前,有没有办法让它停下来?仍在学习如何在此处复制/粘贴,因此请原谅任何缩进错误,这在我的代码中都是正确的。谢谢大家!:)
if password.ShowModal() == wx.ID_OK:
pwd =password.GetValue()
phone_number = wx.TextEntryDialog(self,"Phone Number", "Phone Number", "")
if phone_number.ShowModal() == wx.ID_OK:
number = phone_number.GetValue()
self.carrier = wx.ComboBox(self, -1, pos=(10, 50), choices=carriers, style=wx.CB_READONLY)
self.carrier.Bind(wx.EVT_COMBOBOX, self.onCombo)
if self.carrier.ShowModal() == wx.EVT_COMBOBOX:
message = wx.TextEntryDialog(self,"Your Message", "Your Message", "")
if message.ShowModal() == wx.ID_OK:
msg = message.GetValue()
smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(username, pwd)
header = 'To:' + email + '\n' + 'From: ' + username + '\n' + 'Subject:testing \n'
print header
msg1 = header + msg
smtpserver.sendmail(username, email, msg1)
smtpserver.close()
def onCombo(self, event):
self.selection = self.carrier.GetValue()
print self.selection
print self.number
self.email = number + selection
print email
return self.email