I am making a twitter client in python and wxpython. As of now, my static text is not printing. How can I change this code so it will print out what I want it to?
import wx
import twitter
class main(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id, "Twitter Client", size=(700,400))
panel=wx.Panel(self)
menubar = wx.MenuBar()
file = wx.Menu()
addaccount = wx.MenuItem(file, 1, '&Add Account\tCtrl+A')
quit = wx.MenuItem(file, 2, '&Quit\tCtrl+Q')
file.AppendItem(addaccount)
file.AppendItem(quit)
menubar.Append(file, '&File')
self.SetMenuBar(menubar)
self.Centre()
self.Show(True)
#Bind Events to Menu Item
self.Bind(wx.EVT_MENU, self.info_user, id=1)
self.Bind(wx.EVT_MENU, self.OnQuit, id=2)
#Events
def OnQuit(self, event):
self.Close()
def info_user(self, event):
accountbox_username = wx.TextEntryDialog(None,"Twitter Username","")
if accountbox_username.ShowModal()==wx.ID_OK:
username = accountbox_username.GetValue()
if username != "":
accountbox_password = wx.TextEntryDialog(None,"Twitter Password","")
if accountbox_password.ShowModal()==wx.ID_OK:
password = accountbox_password.GetValue()
if password != "":
password = accountbox_password.GetValue()
#login to twitter
client = twitter.Api(username=username, password=password)
client.PostUpdate("Hello World!")
panel=wx.Panel(self)
#print friends
userlist = client.GetFriends()
for username in userlist:
wx.StaticText(panel, -1, username.screen_name, (10,100))
else:
sorry = wx.MessageDialog(None, 'Your username or password cannot be blank','There was a problem...', wx.OK)
problemanswer = sorry.ShowModal()
else:
sorry = wx.MessageDialog(None, 'Your username or password cannot be blank','There was a problem...', wx.OK)
problemanswer = sorry.ShowModal()
if __name__=='__main__':
app=wx.App()
frame=main(parent=None,id=-1)
app.MainLoop()
I am trying to print out username.screen_name