[Tutor] Get user input in wxpython
danf_1979@yahoo.es
danf_1979 at yahoo.es
Sat Aug 6 18:12:23 CEST 2005
Just if someone is trying something similar... I did it! Thanks Ismael for your info!
...
self.label_1 = wx.StaticText(self.panel_1, -1, "TO:")
self.label_2 = wx.StaticText(self.panel_1, -1, "FROM:")
self.label_3 = wx.StaticText(self.panel_1, -1, "SUBJECT")
self.label_4 = wx.StaticText(self.panel_1, -1, "MESSAGE:")
self.text_ctrl_hacia = wx.TextCtrl(self.panel_1, -1, "")
self.text_ctrl_tumail = wx.TextCtrl(self.panel_1, -1, "")
self.text_ctrl_asunto = wx.TextCtrl(self.panel_1, -1, "")
self.text_ctrl_mensaje = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE)
self.button_sendmail = wx.Button(self.panel_1, -1, "SEND MAIL")
...
wx.EVT_BUTTON(self,self.button_sendmail.GetId(), self.Mail)
...
def Mail(self,event):
print self.text_ctrl_hacia.GetValue()
self.hacia = self.text_ctrl_hacia.GetValue()
self.desde = self.text_ctrl_tumail.GetValue()
self.asunto = self.text_ctrl_asunto.GetValue()
self.mensaje = self.text_ctrl_mensaje.GetValue()
self.body = string.join(("From: %s" % self.desde,"To: %s" % self.hacia,"Subject: %s" % self.asunto,"",self.mensaje), "\r\n")
self.host = "localhost"
server = smtplib.SMTP(self.host)
server.sendmail(self.desde, [self.hacia], self.body)
server.quit()
So I'm sending this mail from my program :)
More information about the Tutor
mailing list