-
Notifications
You must be signed in to change notification settings - Fork 2
/
gui.py
executable file
·40 lines (30 loc) · 934 Bytes
/
gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sys, gtk, json
from threading import Thread
from config import config
from streaming_twitter import TwitterClient
from urllib2 import HTTPError, URLError
from models import Tweet
# Twitter home timeline URL
url = "https://userstream.twitter.com/2/user.json"
friends = []
class PineSiskinWindow(object):
def on_window_destroy(self, widget, data=None):
gtk.main_quit()
def add_tweet(self, tweet):
current_text = text_display.get_buffer()
text_display.set_buffer(current_text + tweet)
def __init__(self):
builder = gtk.Builder()
builder.add_from_file("ui.xml")
self.window = builder.get_object("window")
self.text_display = builder.get_object("text_display")
builder.connect_signals(self)
if __name__ == "__main__":
app = PineSiskinWindow()
def twitter_listener():
# TODO
pass
Thread(target=twitter_listener).start()
# Start the gui
app.window.show()
gtk.main()