Cleaned up the app's appearance, although used a hack to do it...

This commit is contained in:
Anna 2010-04-07 14:07:26 -04:00
parent 75360e053d
commit 85436f093d

View File

@ -38,16 +38,17 @@ class TwitWindow:
for i in range(0, self.num_entries):
self.labels.append(Tkinter.Label(self.tweet_view.interior()))
self.labels[i].pack(expand=False, fill=Tkinter.X)
self.texts.append(Tkinter.Text(self.tweet_view.interior()))
self.texts.append(Tkinter.Label(self.tweet_view.interior()))
self.texts[i].pack(expand=False, fill=Tkinter.X)
self.labels[i].config(bg="#07c", fg="white")
self.texts[i].config(bg="#eff", fg="black", wrap=Tkinter.WORD)
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)
# Create an update box at the bottom of the window
self.update_box = Tkinter.Frame(self.tkroot)
self.update_box.pack(expand=False, fill=Tkinter.X)
self.update_entry = Tkinter.Entry(self.update_box)
self.update_entry.pack(expand=Tkinter.YES, fill=Tkinter.X, side=Tkinter.LEFT)
self.update_entry.bind('<Return>', 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)
@ -60,8 +61,6 @@ class TwitWindow:
def update_window(self) :
statuses = self.api.GetFriendsTimeline(self.username)
for i in range(0, self.num_entries):
self.texts[i].delete(0.0, Tkinter.END) # Clear the old text
if i < len(statuses):
# Update the label with the user's name and screen name
user = statuses[i].user
@ -69,16 +68,17 @@ class TwitWindow:
self.labels[i].config(text=labeltext)
# Display the text of the tweet
self.texts[i].insert(Tkinter.END, statuses[i].text)
self.texts[i].config(text=statuses[i].text)
self.timer = self.tkroot.after(300000, self.update_window)
def update_status(self):
text = self.update_entry.text()
def update_status(self, event):
text = self.update_entry.get()
self.update_entry.delete(0, Tkinter.END)
self.api.PostUpdate(text)
UpdateWindow()
self.update_window()
def scroll_wheel(self, event):
if event.num == 4: