Added a refresh button, and did some changes to the layout: still working on making those look nice

This commit is contained in:
Anna 2010-04-07 14:41:19 -04:00
parent a63f51764f
commit 0b76168037

View File

@ -24,10 +24,11 @@ class TwitWindow:
self.tkroot = Tkinter.Tk() self.tkroot = Tkinter.Tk()
self.tkroot.title("MyTwitter") self.tkroot.title("MyTwitter")
Pmw.initialise(self.tkroot) Pmw.initialise(self.tkroot)
self.tkroot.grid_columnconfigure(0, weight=1)
# Create the scrolled frame that will hold the tweets # Create the scrolled frame that will hold the tweets
self.tweet_view = Pmw.ScrolledFrame(self.tkroot, hscrollmode='none', horizflex='elastic') self.tweet_view = Pmw.ScrolledFrame(self.tkroot, hscrollmode='none', horizflex='elastic')
self.tweet_view.pack(expand=Tkinter.YES, fill=Tkinter.BOTH) self.tweet_view.grid(row=0)
# Create labels and text widgets # Create labels and text widgets
for i in range(0, self.num_entries): for i in range(0, self.num_entries):
@ -38,13 +39,20 @@ class TwitWindow:
self.labels[i].config(bg="#07c", fg="white", anchor=Tkinter.W) self.labels[i].config(bg="#07c", fg="white", anchor=Tkinter.W)
self.texts[i].config(bg="#eff", fg="black", height=3, anchor=Tkinter.NW, justify=Tkinter.LEFT, wraplength=375) self.texts[i].config(bg="#eff", fg="black", height=3, anchor=Tkinter.NW, justify=Tkinter.LEFT, wraplength=375)
# A button to refresh manually
self.button_box = Tkinter.Frame(self.tkroot)
self.button_box.grid(row=1, sticky=Tkinter.W)
self.refresh_button = Tkinter.Button(self.button_box, text="Refresh", command=self.update_window)
self.refresh_button.grid(row=0, sticky=Tkinter.W)
# Create an update box at the bottom of the window # Create an update box at the bottom of the window
self.update_box = Tkinter.Frame(self.tkroot) self.update_box = Tkinter.Frame(self.tkroot)
self.update_box.pack(expand=False, fill=Tkinter.X) self.update_box.grid(row=2, sticky=Tkinter.W)
self.update_entry = Tkinter.Entry(self.update_box) self.update_entry = Tkinter.Entry(self.update_box)
self.update_entry.pack(expand=Tkinter.YES, fill=Tkinter.X, side=Tkinter.LEFT) self.update_entry.grid(row=0, sticky=Tkinter.W)
self.update_box.grid_columnconfigure(0, weight=1)
self.update_button = Tkinter.Button(self.update_box, text="Update", command=self.update_status) self.update_button = Tkinter.Button(self.update_box, text="Update", command=self.update_status)
self.update_button.pack(expand=Tkinter.NO, side=Tkinter.RIGHT) self.update_button.grid(row=0, column=1, sticky=Tkinter.W)
### Set up bindings ### Set up bindings