Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- from Tkinter import *
- #from twitter import *
- import sys
- def Quit():
- RealRoot.destroy()
- class TopWindow(Toplevel):
- def __init__(self,name,**k):
- Toplevel.__init__(self,border=4,**k)
- self.master.withdraw() # hide real tk root
- self.title(name)
- def run(self):
- self.center()
- self.focus()
- self.wait_window()
- def focus(self):
- self.grab_set()
- self.focus_set()
- def center(self):
- self.update_idletasks()
- w= self["width"]!=0 and self["width"] or self.winfo_width()
- h= self["height"]!=0 and self["height"] or self.winfo_height()
- ws,hs = self.winfo_screenwidth(),self.winfo_screenheight()
- self.geometry('%dx%d+%d+%d' % (w, h, (ws/2) - (w/2), (hs/2) - (h/2)))
- RealRoot=Tk()
- RealRoot.title("Jason Twitter Client")
- RealRoot.config(bg="light blue")
- RealRoot.protocol("WM_DELETE_WINDOW",RealRoot.quit)
- Root=TopWindow("Jason Twitter Client")
- Root.protocol("WM_DELETE_WINDOW",RealRoot.quit)
- Status=Label(Root,text="Status:",bg="light blue")
- Status.grid(column=1,row=0,sticky=N+S+E+W)
- StatusText=Text(Root,bg="white",height=2)
- StatusText.grid(column=2,row=0,columnspan=5,sticky=N+S+E+W)
- Refresh=Button(Root,text="Refresh")
- Refresh.grid(column=8,row=0,sticky=N+S+E+W)
- DisplayScroll=Scrollbar(Root,orient=VERTICAL)
- DisplayScroll.grid(column=8,row=2,rowspan=8,sticky=N+S+W)
- Display=Text(Root,bg="white",yscrollcommand=DisplayScroll.set)
- Display.grid(column=3,row=2,columnspan=5,rowspan=9,sticky=N+S+E+W)
- DisplayScroll["command"]=Display.yview
- Home=Button(Root,text="Home")
- Home.grid(column=0,row=1,sticky=N+S+E+W)
- Profile=Button(Root,text="Profile")
- Profile.grid(column=1,row=1,sticky=N+S+E+W)
- ChoiceVar=IntVar()
- FriendChoice=Radiobutton(Root,text="Friends",variable=ChoiceVar,value=0,bg="light blue")
- FriendChoice.grid(column=0,row=2,columnspan=2,sticky=W)
- FollowerChoice=Radiobutton(Root,text="Followers",variable=ChoiceVar,value=1,bg="light blue")
- FollowerChoice.grid(column=0,row=3,columnspan=2,sticky=W)
- UserScroll=Scrollbar(Root,orient=VERTICAL)
- UserScroll.grid(column=2,row=4,rowspan=5,sticky=N+S)
- Users=Listbox(Root,bg="white",height=15,yscrollcommand=UserScroll.set)
- Users.grid(column=0,row=4,rowspan=5,columnspan=2)
- UserScroll["command"]=Users.yview
- Search=Label(Root,text="Search:")
- Search.grid(column=3,row=1,sticky=N+S+E+W)
- SearchText=Entry(Root,bg="white")
- SearchText.grid(column=4,row=1,columnspan=3,sticky=N+S+E+W)
- SearchButton=Button(Root,text="Search")
- SearchButton.grid(column=8,row=1,sticky=N+S+E+W)
- TweetLabel=Label(Root,text="Tweet:")
- TweetLabel.grid(column=3,row=10,sticky=N+S+E+W)
- TweetText=Entry(Root,bg="white")
- TweetText.grid(column=4,row=10,columnspan=3,sticky=N+S+E+W)
- TweetButton=Button(Root,text="Tweet")
- TweetButton.grid(column=8,row=10,sticky=N+S+E+W)
- CharsLeft=Message(Root,text="140",bg="light blue")
- CharsLeft.grid(column=8,row=9)
- Root.run()
- CredWindow=TopWindow("User Credentials")
- CredText=Label(CredWindow,text="Welcome to pyTweet!")
- CredText.grid(column=0,row=0,columnspan=2,sticky=N+S+E+W)
- UsernameText=Label(CredWindow,text="Username:")
- UsernameText.grid(column=0,row=1,sticky=N+S+E+W)
- PasswordText=Label(CredWindow,text="Password:")
- PasswordText.grid(column=0,row=2,sticky=N+S+E+W)
- UsernameEntry=Entry(CredWindow)
- UsernameEntry.grid(column=1,row=1,sticky=N+S+E+W)
- PasswordEntry=Entry(CredWindow,show="*")
- PasswordEntry.grid(column=1,row=2,sticky=N+S+E+W)
- LoginButton=Button(CredWindow,text="Login")
- LoginButton.grid(column=0,row=3,columnspan=2)
- CredWindow.run()
- #class FriendWindow:
- # def __init__(self)
- #
- # def Makefwin:
- # Fwin=Toplevel()
- # InfoPane=Text(Fwin)
- # InfoPane.grid(column=2,row=0,columnspan=8,rowspan=8,sticky=N+S+E+W)
- Root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement