943,929 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 1499
  • Python RSS
Oct 27th, 2009
0

wxPython text overwrite problem...

Expand Post »
Hey All,

I have some code here, the problem is in line 82-83:
python Syntax (Toggle Plain Text)
  1. import smtplib
  2. import wx
  3.  
  4. window=wx.App()
  5.  
  6. class pymailer(wx.Frame):
  7.  
  8. def __init__(self):
  9. wx.Frame.__init__(self,None,-1,"Py-mailer",size=(500,700))
  10.  
  11. try:
  12. self.s=smtplib.SMTP("smtp.gmail.com",587)
  13. self.s.starttls()
  14. except:
  15. wx.MessageBox("Error 001: Could not connect to the internet, please try again later.","Internet Connection Error")
  16.  
  17. self.panel=wx.Panel(self,-1)
  18.  
  19. menubar=wx.MenuBar()
  20.  
  21. filem=wx.Menu()
  22. filem.Append(201,"Quit")
  23. self.Bind(wx.EVT_MENU,self.Quit,id=201)
  24.  
  25. viewm=wx.Menu()
  26. viewm.Append(202,"About")
  27. self.Bind(wx.EVT_MENU,self.About,id=202)
  28.  
  29. menubar.Append(filem,"File")
  30. menubar.Append(viewm,"Help")
  31.  
  32. self.SetMenuBar(menubar)
  33.  
  34. wx.StaticText(self.panel,-1,"Welcome to Py-mailer.\n\nLogin with your Gmail credentials and you can send a text-only email to anyone quickly and easily.",pos=(10,10))
  35. wx.StaticText(self.panel,-1,"Please enter your Gmail login ID: ",pos=(10,100))
  36. wx.StaticText(self.panel,-1,"Please enter your Gmail login password:\n(will not be stored)",pos=(10,130))
  37.  
  38. self.username=wx.TextCtrl(self.panel,101,"Login ID",pos=(220,100))
  39. self.password=wx.TextCtrl(self.panel,102,"Password",style=(wx.TE_PASSWORD),pos=(220,130))
  40.  
  41. login=wx.Button(self.panel,103,label="Login",pos=(10,170))
  42. self.Bind(wx.EVT_BUTTON,self.Login,id=103)
  43.  
  44. wx.StaticText(self.panel,-1,"To:",pos=(10,250))
  45. wx.StaticText(self.panel,-1,"Subject:",pos=(10,280))
  46. wx.StaticText(self.panel,-1,"Message:",pos=(10,310))
  47.  
  48. self.to_info=wx.TextCtrl(self.panel,104,pos=(80,250),size=(240,20))
  49. self.sub_info=wx.TextCtrl(self.panel,105,pos=(80,280),size=(240,20))
  50. self.msg_info=wx.TextCtrl(self.panel,106,pos=(80,310),size=(240,150))
  51.  
  52. send=wx.Button(self.panel,107,"Send",pos=(245,470))
  53. self.Bind(wx.EVT_BUTTON,self.Send,id=107)
  54.  
  55. self.Centre()
  56. self.Show()
  57.  
  58. def Quit(self,event):
  59. self.Close()
  60.  
  61. def About(self,event):
  62. about=wx.AboutDialogInfo()
  63.  
  64. about.SetName("Py-Mailer")
  65. about.SetCopyright("(c) 2009 Sravan")
  66. about.SetWebSite("http://www.uberpix.wordpress.com")
  67. about.AddDeveloper("Sravan")
  68. about.AddDeveloper("Daniel Pacheco")
  69.  
  70. wx.AboutBox(about)
  71.  
  72. def Login(self,event):
  73.  
  74. self.user=self.username.GetValue()
  75. self.passw=self.password.GetValue()
  76.  
  77. if(self.user=="" and self.passw==""):
  78. wx.MessageBox("Error 002: You did not enter your username and/or password","Enter Login Details")
  79.  
  80. try:
  81. self.s.login(self.user,self.passw)
  82. wx.StaticText(self.panel,-1,"Logged in...",pos=(10,200))
  83. except:
  84. wx.StaticText(self.panel,-1,"Failed",pos=(10,200))
  85.  
  86.  
  87. def Send(self,event):
  88. self.to=self.to_info.GetValue()
  89. self.subject=self.sub_info.GetValue()
  90. self.message=self.msg_info.GetValue()
  91. self.msg="To: "+self.to+"\nSubject: "+self.subject+"\n"+self.message
  92. self.s.sendmail(self.user,self.to,self.msg)
  93. self.s.quit()
  94.  
  95. wx.StaticText(self.panel,-1,"Your message has been sent!",pos=(175,500))
  96.  
  97. pymailer()
  98. window.MainLoop()
- because once I login successfully, if I again login with wrong details, the "Failed" text doesn't overwrite the "Logged in..." text fully.... so what do I do?

Thanks a load
Last edited by sravan953; Oct 27th, 2009 at 1:15 pm.
Similar Threads
Reputation Points: 2
Solved Threads: 30
Posting Whiz in Training
sravan953 is offline Offline
242 posts
since May 2009
Oct 27th, 2009
0
Re: wxPython text overwrite problem...
How about instead of just generating an arbitrary StaticText object, assign it to a persistent member of your class (let's call it self.login_status_text ). Then instead of generating it each time, simply update the contents to the proper string (It's been years since messing with wxPython but if I remember correctly you might want to use SetLabel in this case).
Reputation Points: 355
Solved Threads: 292
Veteran Poster
jlm699 is offline Offline
1,102 posts
since Jul 2008
Oct 27th, 2009
0
Re: wxPython text overwrite problem...
You can set size so the text get overwrite.
And som color look better.
Python Syntax (Toggle Plain Text)
  1. try:
  2. self.s.login(self.user,self.passw)
  3. wx.StaticText(self.panel,-1,"Logged in...",pos=(10,200),size = (150,20)).SetForegroundColour('blue')
  4. except:
  5. wx.StaticText(self.panel,-1,"Failed",pos=(10,200),size = (150,20)).SetForegroundColour('red')

For me i have to have this put in this lines or it dont work for me.
Python Syntax (Toggle Plain Text)
  1. self.s.ehlo()
  2. self.s.starttls()
  3. self.s.ehlo()
And your design need some work,can give som tips later if you want that.
Last edited by snippsat; Oct 27th, 2009 at 3:08 pm.
Reputation Points: 280
Solved Threads: 278
Master Poster
snippsat is offline Offline
771 posts
since Aug 2008
Oct 27th, 2009
0
Re: wxPython text overwrite problem...
Click to Expand / Collapse  Quote originally posted by snippsat ...
You can set size so the text get overwrite.
And som color look better.
Python Syntax (Toggle Plain Text)
  1. try:
  2. self.s.login(self.user,self.passw)
  3. wx.StaticText(self.panel,-1,"Logged in...",pos=(10,200),size = (150,20)).SetForegroundColour('blue')
  4. except:
  5. wx.StaticText(self.panel,-1,"Failed",pos=(10,200),size = (150,20)).SetForegroundColour('red')

For me i have to have this put in this lines or it dont work for me.
Python Syntax (Toggle Plain Text)
  1. self.s.ehlo()
  2. self.s.starttls()
  3. self.s.ehlo()
And your design need some work,can give som tips later if you want that.
I would be glad to get some tips from you!
Reputation Points: 2
Solved Threads: 30
Posting Whiz in Training
sravan953 is offline Offline
242 posts
since May 2009
Oct 27th, 2009
0
Re: wxPython text overwrite problem...
Click to Expand / Collapse  Quote originally posted by jlm699 ...
How about instead of just generating an arbitrary StaticText object, assign it to a persistent member of your class (let's call it self.login_status_text ). Then instead of generating it each time, simply update the contents to the proper string (It's been years since messing with wxPython but if I remember correctly you might want to use SetLabel in this case).
I changed lines 81-85 to this:
'python Syntax (Toggle Plain Text)
  1. try:
  2. self.s.login(self.user,self.passw)
  3. self.loginmsg.SetLabel("Logged in...")
  4. except:
  5. self.loginmsg.SetLabel("Failed to login, please try again...")

But it still doesn't overwrite properly... guess I will just have to settle on snippsat's opinion...
Reputation Points: 2
Solved Threads: 30
Posting Whiz in Training
sravan953 is offline Offline
242 posts
since May 2009
Oct 28th, 2009
0
Re: wxPython text overwrite problem...
Hi here are som changes.
Done some work on this,i was thinking making somthing simelar as this for fun.
So helping you a little is no problem,set my self as co-developer in about box if you dont mind.

Here are changes.

----------| Change log |---------

* Change on size and design | New headerpicture

* Take away maximize window (wx.MINIMIZE_BOX)

* Ico for Frame and about box

* New about box style

* Picture buttons

* Bigger message Box and multiline enable(wx.TE_MULTILINE)

* Exception handling on mail sent with new StaticText message

* Better documentation of code

----------| idèe for future development |--------

* Email attachment(file)

* Contact list load

* Save default login

http://www.esnips.com/doc/c2e05e06-5...05ed/py-mailer

Python Syntax (Toggle Plain Text)
  1. import smtplib
  2. import time
  3. import os
  4. import wx
  5. from wx.lib.wordwrap import wordwrap
  6.  
  7. window = wx.App()
  8. class pymailer(wx.Frame):
  9. '''
  10. Program to send gmail message
  11. '''
  12. def __init__(self):
  13. wx.Frame.__init__(self, None, wx.ID_ANY,"Py-mailer",size=(330,520),
  14. style = wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX)
  15. #----| Window color |---#
  16. self.SetBackgroundColour("#d8d8bf")
  17.  
  18. #---| Add a panel so it looks the correct on all platforms |---#
  19. self.panel = wx.Panel(self, wx.ID_ANY)
  20.  
  21. #---| Ico for window |---#
  22. ico = wx.Icon('email1.ico', wx.BITMAP_TYPE_ICO)
  23. self.SetIcon(ico)
  24.  
  25. #----| Gmail server |---#
  26. self.info = {}
  27. self.s = smtplib.SMTP("smtp.gmail.com",587)
  28. self.s.ehlo()
  29. self.s.starttls()
  30. self.s.ehlo()
  31.  
  32. #---| Menu bar |---#
  33. menubar=wx.MenuBar()
  34. filem=wx.Menu()
  35. filem.Append(201,"Quit")
  36. self.Bind(wx.EVT_MENU,self.Quit,id=201)
  37. viewm = wx.Menu()
  38. viewm.Append(202,"About")
  39. self.Bind(wx.EVT_MENU,self.About,id=202)
  40. menubar.Append(filem,"File")
  41. menubar.Append(viewm,"Help")
  42. self.SetMenuBar(menubar)
  43.  
  44. #---| Picture Buttons |---#
  45. self.send = wx.BitmapButton(self.panel,107,wx.Bitmap("py_email1.png"),
  46. pos = (7,430), size = (65,26))
  47. self.Bind(wx.EVT_BUTTON,self.Send,id = 107)
  48. self.login = wx.BitmapButton(self.panel,103,wx.Bitmap("py_email2.png"),
  49. pos = (7,123), size = (65,26))
  50. self.Bind(wx.EVT_BUTTON,self.Login,id = 103)
  51.  
  52. #---| Standar Buttons |---#
  53. #login = wx.Button(self.panel,103,label = "Login", pos = (10,120))
  54. #self.Bind(wx.EVT_BUTTON,self.Login,id = 103)
  55. #send = wx.Button(self.panel, 107, "Send", pos = (50,400))
  56. #self.Bind(wx.EVT_BUTTON, self.Send,id = 107)
  57.  
  58. #---| Picture |---#
  59. self.bitmap_1 = wx.StaticBitmap(self, -1, wx.Bitmap("py1.png",
  60. wx.BITMAP_TYPE_ANY),pos = (43,5 ), size = (250,42))
  61.  
  62. #---| Label Text |---#
  63. wx.StaticText(self, -1, '---------------------------------------------------------------------------',
  64. pos = (10,107), size = (400,13 )).SetForegroundColour('blue')
  65. wx.StaticText(self, -1, '---------------------------------------------------------------------------',
  66. pos = (10,35), size = (400,13 )).SetForegroundColour('blue')
  67. wx.StaticText(self, -1, '---------------------------------------------------------------------------',
  68. pos = (10,150), size = (400,13 )).SetForegroundColour('blue')
  69. #wx.StaticText(self.panel,-1,"Welcome to Py-mailer.\nLogin with your Gmail credentials and you can send a text-only email to anyone quickly and easily.",pos=(10,10))
  70. wx.StaticText(self.panel,-1,"Enter your Gmail login ID: ",pos = (10,55))
  71. wx.StaticText(self.panel,-1,"Enter your Gmail password:\n(will not be stored)",pos = (10,80))
  72. wx.StaticText(self.panel,-1,"To:",pos = (10,180))
  73. wx.StaticText(self.panel,-1,"Subject:",pos = (10,210))
  74. wx.StaticText(self.panel,-1,"Message",pos = (135,240)).SetForegroundColour('brown')
  75.  
  76. #----| TextBox |---#
  77. self.username = wx.TextCtrl(self.panel,101,"tomlaa1@gmail.com",pos = (150,50),size = (160,20))
  78. self.password = wx.TextCtrl(self.panel,102,"qqqqqq11",style = (wx.TE_PASSWORD), pos = (150,80),size = (160,20))
  79. self.to_info = wx.TextCtrl(self.panel,104,pos = (70,180),size = (240,20))
  80. self.sbj_info = wx.TextCtrl(self.panel,105,pos = (70,210),size = (240,20))
  81. self.msg_info = wx.TextCtrl(self.panel,106,style = wx.TE_MULTILINE,pos = (13,265),size = (300,150))
  82.  
  83. self.Centre()
  84. self.Show()
  85.  
  86. def Quit(self,event):
  87. self.Close()
  88.  
  89. def Login(self,event):
  90. self.user=self.username.GetValue()
  91. self.passw=self.password.GetValue()
  92. try:
  93. self.s.login(self.user,self.passw)
  94. wx.StaticText(self.panel,-1,"You are logged in...",pos = (130,127)).SetForegroundColour('blue')
  95. except:
  96. wx.StaticText(self.panel,-1,"Login in failed",pos = (100,125)).SetForegroundColour('red')
  97.  
  98. def Send(self,event):
  99. self.info["To"] = self.to_info.GetValue()
  100. self.info["Subject"] = self.sbj_info.GetValue()
  101. self.info["Message"]= self.msg_info.GetValue()
  102.  
  103. self.to=self.info["To"]
  104. self.subject = self.info["Subject"]
  105. self.message = self.info["Message"]
  106. self.msg = "To: " + self.to + "\nSubject: " + self.subject+"\n" + self.message
  107.  
  108. try:
  109. self.s.sendmail(self.user,self.to,self.msg)
  110. wx.StaticText(self.panel,-1,"Mail send successfully",pos = (120,435)).SetForegroundColour('blue')
  111. self.s.quit()
  112. except:
  113. wx.StaticText(self.panel,-1,"Mail not sent",pos = (120,435)).SetForegroundColour('red')
  114.  
  115. def About(self,event):
  116. '''
  117. Show about window
  118. '''
  119. info = wx.AboutDialogInfo()
  120. info.Name = "Py-Mailer"
  121. info.Version = "version ?"
  122. info.Copyright = ""
  123. info.Description = wordwrap(
  124. 'info about this program......' ,
  125. 350, wx.ClientDC(self))
  126. info.WebSite = ("http://www.uberpix.wordpress.com", "Sravan home")
  127. info.Developers = [ "Dan Sravan\n"
  128. 'Co-developer:\n'
  129. 'Snippsat',]
  130. info.License = wordwrap(licenseText, 500, wx.ClientDC(self))
  131. wx.AboutBox(info)
  132. licenseText = 'Copyright(c) 2009 Sravan'
  133.  
  134. pymailer()
  135. window.MainLoop()
Attached Thumbnails
Click image for larger version

Name:	pymail.png
Views:	36
Size:	21.2 KB
ID:	12345   Click image for larger version

Name:	pymail1.png
Views:	39
Size:	21.7 KB
ID:	12346  
Last edited by snippsat; Oct 28th, 2009 at 7:11 pm.
Reputation Points: 280
Solved Threads: 278
Master Poster
snippsat is offline Offline
771 posts
since Aug 2008
Oct 31st, 2009
0

How'd you get the images?

Click to Expand / Collapse  Quote originally posted by snippsat ...
Hi here are som changes.
Done some work on this,i was thinking making somthing simelar as this for fun.
So helping you a little is no problem,set my self as co-developer in about box if you dont mind.

Here are changes.

----------| Change log |---------

* Change on size and design | New headerpicture

* Take away maximize window (wx.MINIMIZE_BOX)

* Ico for Frame and about box

* New about box style

* Picture buttons

* Bigger message Box and multiline enable(wx.TE_MULTILINE)

* Exception handling on mail sent with new StaticText message

* Better documentation of code

----------| idèe for future development |--------

* Email attachment(file)

* Contact list load

* Save default login

http://www.esnips.com/doc/c2e05e06-5...05ed/py-mailer

Python Syntax (Toggle Plain Text)
  1. import smtplib
  2. import time
  3. import os
  4. import wx
  5. from wx.lib.wordwrap import wordwrap
  6.  
  7. window = wx.App()
  8. class pymailer(wx.Frame):
  9. '''
  10. Program to send gmail message
  11. '''
  12. def __init__(self):
  13. wx.Frame.__init__(self, None, wx.ID_ANY,"Py-mailer",size=(330,520),
  14. style = wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX)
  15. #----| Window color |---#
  16. self.SetBackgroundColour("#d8d8bf")
  17.  
  18. #---| Add a panel so it looks the correct on all platforms |---#
  19. self.panel = wx.Panel(self, wx.ID_ANY)
  20.  
  21. #---| Ico for window |---#
  22. ico = wx.Icon('email1.ico', wx.BITMAP_TYPE_ICO)
  23. self.SetIcon(ico)
  24.  
  25. #----| Gmail server |---#
  26. self.info = {}
  27. self.s = smtplib.SMTP("smtp.gmail.com",587)
  28. self.s.ehlo()
  29. self.s.starttls()
  30. self.s.ehlo()
  31.  
  32. #---| Menu bar |---#
  33. menubar=wx.MenuBar()
  34. filem=wx.Menu()
  35. filem.Append(201,"Quit")
  36. self.Bind(wx.EVT_MENU,self.Quit,id=201)
  37. viewm = wx.Menu()
  38. viewm.Append(202,"About")
  39. self.Bind(wx.EVT_MENU,self.About,id=202)
  40. menubar.Append(filem,"File")
  41. menubar.Append(viewm,"Help")
  42. self.SetMenuBar(menubar)
  43.  
  44. #---| Picture Buttons |---#
  45. self.send = wx.BitmapButton(self.panel,107,wx.Bitmap("py_email1.png"),
  46. pos = (7,430), size = (65,26))
  47. self.Bind(wx.EVT_BUTTON,self.Send,id = 107)
  48. self.login = wx.BitmapButton(self.panel,103,wx.Bitmap("py_email2.png"),
  49. pos = (7,123), size = (65,26))
  50. self.Bind(wx.EVT_BUTTON,self.Login,id = 103)
  51.  
  52. #---| Standar Buttons |---#
  53. #login = wx.Button(self.panel,103,label = "Login", pos = (10,120))
  54. #self.Bind(wx.EVT_BUTTON,self.Login,id = 103)
  55. #send = wx.Button(self.panel, 107, "Send", pos = (50,400))
  56. #self.Bind(wx.EVT_BUTTON, self.Send,id = 107)
  57.  
  58. #---| Picture |---#
  59. self.bitmap_1 = wx.StaticBitmap(self, -1, wx.Bitmap("py1.png",
  60. wx.BITMAP_TYPE_ANY),pos = (43,5 ), size = (250,42))
  61.  
  62. #---| Label Text |---#
  63. wx.StaticText(self, -1, '---------------------------------------------------------------------------',
  64. pos = (10,107), size = (400,13 )).SetForegroundColour('blue')
  65. wx.StaticText(self, -1, '---------------------------------------------------------------------------',
  66. pos = (10,35), size = (400,13 )).SetForegroundColour('blue')
  67. wx.StaticText(self, -1, '---------------------------------------------------------------------------',
  68. pos = (10,150), size = (400,13 )).SetForegroundColour('blue')
  69. #wx.StaticText(self.panel,-1,"Welcome to Py-mailer.\nLogin with your Gmail credentials and you can send a text-only email to anyone quickly and easily.",pos=(10,10))
  70. wx.StaticText(self.panel,-1,"Enter your Gmail login ID: ",pos = (10,55))
  71. wx.StaticText(self.panel,-1,"Enter your Gmail password:\n(will not be stored)",pos = (10,80))
  72. wx.StaticText(self.panel,-1,"To:",pos = (10,180))
  73. wx.StaticText(self.panel,-1,"Subject:",pos = (10,210))
  74. wx.StaticText(self.panel,-1,"Message",pos = (135,240)).SetForegroundColour('brown')
  75.  
  76. #----| TextBox |---#
  77. self.username = wx.TextCtrl(self.panel,101,"tomlaa1@gmail.com",pos = (150,50),size = (160,20))
  78. self.password = wx.TextCtrl(self.panel,102,"qqqqqq11",style = (wx.TE_PASSWORD), pos = (150,80),size = (160,20))
  79. self.to_info = wx.TextCtrl(self.panel,104,pos = (70,180),size = (240,20))
  80. self.sbj_info = wx.TextCtrl(self.panel,105,pos = (70,210),size = (240,20))
  81. self.msg_info = wx.TextCtrl(self.panel,106,style = wx.TE_MULTILINE,pos = (13,265),size = (300,150))
  82.  
  83. self.Centre()
  84. self.Show()
  85.  
  86. def Quit(self,event):
  87. self.Close()
  88.  
  89. def Login(self,event):
  90. self.user=self.username.GetValue()
  91. self.passw=self.password.GetValue()
  92. try:
  93. self.s.login(self.user,self.passw)
  94. wx.StaticText(self.panel,-1,"You are logged in...",pos = (130,127)).SetForegroundColour('blue')
  95. except:
  96. wx.StaticText(self.panel,-1,"Login in failed",pos = (100,125)).SetForegroundColour('red')
  97.  
  98. def Send(self,event):
  99. self.info["To"] = self.to_info.GetValue()
  100. self.info["Subject"] = self.sbj_info.GetValue()
  101. self.info["Message"]= self.msg_info.GetValue()
  102.  
  103. self.to=self.info["To"]
  104. self.subject = self.info["Subject"]
  105. self.message = self.info["Message"]
  106. self.msg = "To: " + self.to + "\nSubject: " + self.subject+"\n" + self.message
  107.  
  108. try:
  109. self.s.sendmail(self.user,self.to,self.msg)
  110. wx.StaticText(self.panel,-1,"Mail send successfully",pos = (120,435)).SetForegroundColour('blue')
  111. self.s.quit()
  112. except:
  113. wx.StaticText(self.panel,-1,"Mail not sent",pos = (120,435)).SetForegroundColour('red')
  114.  
  115. def About(self,event):
  116. '''
  117. Show about window
  118. '''
  119. info = wx.AboutDialogInfo()
  120. info.Name = "Py-Mailer"
  121. info.Version = "version ?"
  122. info.Copyright = ""
  123. info.Description = wordwrap(
  124. 'info about this program......' ,
  125. 350, wx.ClientDC(self))
  126. info.WebSite = ("http://www.uberpix.wordpress.com", "Sravan home")
  127. info.Developers = [ "Dan Sravan\n"
  128. 'Co-developer:\n'
  129. 'Snippsat',]
  130. info.License = wordwrap(licenseText, 500, wx.ClientDC(self))
  131. wx.AboutBox(info)
  132. licenseText = 'Copyright(c) 2009 Sravan'
  133.  
  134. pymailer()
  135. window.MainLoop()
How did you make those images?
Reputation Points: 2
Solved Threads: 30
Posting Whiz in Training
sravan953 is offline Offline
242 posts
since May 2009
Oct 31st, 2009
0
Re: wxPython text overwrite problem...
Quote ...
How did you make those images?
Du you mean the Attached Thumbnails?
Thats just screenshot capture with free program jing.
http://www.jingproject.com/
Reputation Points: 280
Solved Threads: 278
Master Poster
snippsat is offline Offline
771 posts
since Aug 2008
Nov 1st, 2009
0
Re: wxPython text overwrite problem...
Note that the way you use try/except is not very wise.
Python Syntax (Toggle Plain Text)
  1. try:
  2. self.s.sendmail(self.user,self.to,self.msg)
  3. wx.StaticText(self.panel,-1,"Mail send successfully",pos = (120,435)).SetForegroundColour('blue')
  4. self.s.quit()
  5. except:
  6. wx.StaticText(self.panel,-1,"Mail not sent",pos = (120,435)).SetForegroundColour('red')
You should do something like this instead:
Python Syntax (Toggle Plain Text)
  1. try:
  2. self.s.sendmail(self.user,self.to,self.msg)
  3. except LoginError:
  4. wx.StaticText(self.panel,-1,"Mail not sent",pos = (120,435)).SetForegroundColour('red')
  5. else:
  6. wx.StaticText(self.panel,-1,"Mail send successfully",pos = (120,435)).SetForegroundColour('blue')
  7. self.s.quit()
Reputation Points: 20
Solved Threads: 25
Junior Poster in Training
pythopian is offline Offline
81 posts
since Nov 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Find largest file in directory
Next Thread in Python Forum Timeline: Reasons to extend Python with C





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC