def __init__(self, master): tk.Frame.__init__(self, master) self.pack() self.master.title("") self.master.resizable(False, False) self.master.tk_setPalette(background='#ececec') self.master.protocol('WM_DELETE_WINDOW', self.click_cancel) self.master.bind('<Return>', self.click_ok) self.master.bind('<Escape>', self.click_cancel) x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2 y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3 self.master.geometry("+{}+{}".format(x, y)) self.master.config(menu=tk.Menu(self)) tk.Message(self, text=greeting(), font='System 18 bold', justify='left', aspect=800).pack(pady=(5, 0)) tk.Message(self, text="Step 4. Get Followers/Friends Info", font='System 14 bold', justify='left', aspect=1800).pack(pady=(5, 0)) ## frame 1 f1 = tk.Frame(self) f1.pack(padx=60, pady=(15, 0), anchor='w') tk.Label( f1, text='Username whose followers/friends you hope to learn:').grid( row=0, column=0, columnspan=6, sticky='w') tk.Label(f1, text='Username:'******'w') self.l1 = tk.Entry(f1, background='white', width=30) self.l1.grid(row=1, column=1, columnspan=5, sticky='w') self.l1.insert(0, "realDonaldTrump") tk.Label(f1, text='Output path:').grid(row=2, column=0, sticky='w') self.l2 = tk.Entry(f1, background='white', width=30) self.l2.grid(row=2, column=1, sticky='w') self.l2.insert(0, "./info") ## frame 1 buttons fb = tk.Frame(self) fb.pack(padx=60, pady=(5, 0), anchor='e') self.stb = tk.Button(fb, text='Followers', height=1, width=6, command=self.click_ok) self.stb.pack(side='right') self.stb.bind("<Enter>", self.hover_on) self.stb.bind("<Leave>", self.hover_off) self.stb2 = tk.Button(fb, text='Friends', height=1, width=6, command=self.click_ok2) self.stb2.pack(side='right', padx=10) self.stb2.bind("<Enter>", self.hover_on2) self.stb2.bind("<Leave>", self.hover_off) self.stb2_4 = tk.Button(fb, text='FriendNet', height=1, width=6, command=self.click_ok2_5) self.stb2_4.pack(side='right') self.stb2_4.bind("<Enter>", self.hover_on7) self.stb2_4.bind("<Leave>", self.hover_off) self.stb2_5 = tk.Button(fb, text='Check', height=1, width=6, state='disabled', command=self.click_check) self.stb2_5.pack(side='right', padx=10) self.stb2_5.bind("<Enter>", self.hover_on6) self.stb2_5.bind("<Leave>", self.hover_off) ##frame 2 f2 = tk.Frame(self) f2.pack(padx=60, anchor='w') tk.Label(f2, text=' ').grid(row=3, column=0, sticky='w') tk.Label(f2, text='The Tweeter ids you wish to learn more about:').grid( row=4, column=0, columnspan=10, sticky='w') tk.Label(f2, text='File path: ').grid(row=5, column=0, sticky='w') self.l3 = tk.Entry(f2, background='white', width=30) self.l3.grid(row=5, column=1, columnspan=1, sticky='w') self.l3.insert(0, "./info/realDonaldTrump_friend.txt") ## frame 2 buttons fb2 = tk.Frame(self) fb2.pack(padx=60, pady=(5, 30), anchor='e') self.stb3 = tk.Button(fb2, text='.json', height=1, width=6, command=self.click_ok3) self.stb3.pack(side='right') self.stb3.bind("<Enter>", self.hover_on3) self.stb3.bind("<Leave>", self.hover_off) self.stb4 = tk.Button(fb2, text='.csv', height=1, width=6, command=self.click_ok4) self.stb4.pack(side='right', padx=10) self.stb4.bind("<Enter>", self.hover_on4) self.stb4.bind("<Leave>", self.hover_off) self.stb5_5 = tk.Button(fb2, text='Check', height=1, width=6, state='disabled', command=self.click_check2) self.stb5_5.pack(side='right') self.stb5_5.bind("<Enter>", self.hover_on6) self.stb5_5.bind("<Leave>", self.hover_off) self.stb5 = tk.Button(fb2, text='Save & Quit', height=1, width=8, command=self.click_cancel) self.stb5.pack(side='right', padx=10) ## frame last fb3 = tk.Frame(self) fb3.pack(padx=60, pady=(0, 30), anchor='e') self.label = tk.Label(fb3, anchor="w", fg="white", bg="blue", text=start_bt_ms, width=45) self.label.pack()
def __init__(self, master): tk.Frame.__init__(self, master) self.pack() self.master.title("") self.master.resizable(False, False) self.master.tk_setPalette(background='#ececec') self.master.protocol('WM_DELETE_WINDOW', self.click_cancel) self.master.bind('<Return>', self.click_ok) self.master.bind('<Escape>', self.click_cancel) x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2 y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3 self.master.geometry("+{}+{}".format(x, y)) self.master.config(menu=tk.Menu(self)) tk.Message(self, text=greeting(), font='System 18 bold', justify='left', aspect=800).pack(pady=(5, 0)) tk.Message(self, text="Step 2. Labeling", font='System 14 bold', justify='left', aspect=800).pack(pady=(5, 0)) ## frame 1 f1 = tk.Frame(self) f1.pack(padx=60, pady=15, anchor='w') self.f1l1 = tk.Label( f1, text='The keywords to label tweets as class 1 (positive.txt):') self.f1l1.grid(row=0, column=0, columnspan=2, sticky='w') self.f1l1L = tk.Label(f1, text='Keyword:') self.f1l1L.grid(row=1, column=0, sticky='w') self.user_input = tk.Entry(f1, background='white', width=30) self.user_input.grid(row=1, column=1, sticky='w') tk.Label(f1, text=' ').grid(row=2, column=0, sticky='w') self.f1l2 = tk.Label( f1, text='The keywords to label tweets as class 2 (negative.txt):') self.f1l2.grid(row=3, column=0, columnspan=2, sticky='w') self.f1l2L = tk.Label(f1, text='Keyword:') self.f1l2L.grid(row=4, column=0, sticky='w') self.user_input2 = tk.Entry(f1, background='white', width=30) self.user_input2.grid(row=4, column=1, sticky='w') tk.Label(f1, text=' ').grid(row=5, column=0, sticky='w') self.f1l3 = tk.Label( f1, text='The file containing fetched tweets (default in ./output):') self.f1l3.grid(row=6, column=0, columnspan=2, sticky='w') self.f1l3L = tk.Label(f1, text='Path:') self.f1l3L.grid(row=7, column=0, sticky='w') self.pass_input = tk.Entry(f1, background='white', width=30) #self.pass_input.insert(0,"./output/stream_(step1Tag).txt") self.pass_input.insert(0, "./output/stream_China.txt") self.pass_input.grid(row=7, column=1, sticky='w') ##frame middle 1.5 f1_5 = tk.Frame(self) f1_5.pack(padx=60, pady=(5, 0), anchor='w') self.ctl_tx = tk.Label( f1_5, anchor="w", fg='black', state='disabled', text="Manually label each tweet displayed by following buttons", width=45) self.ctl_tx.pack() self.ctl_1 = tk.Button(f1_5, text='Class1', height=1, width=6, state='disabled', command=self.click_1) self.ctl_1.bind('<Enter>', self.hover_1) self.ctl_1.bind('<Leave>', self.hover_off) self.ctl_1.pack(side='right') self.ctl_2 = tk.Button(f1_5, text='Class2', height=1, width=6, state='disabled', command=self.click_2) self.ctl_2.bind('<Enter>', self.hover_2) self.ctl_2.bind('<Leave>', self.hover_off) self.ctl_2.pack(side='right') self.ctl_3 = tk.Button(f1_5, text='Skip', height=1, width=6, state='disabled', command=self.click_3) self.ctl_3.bind('<Enter>', self.hover_3) self.ctl_3.bind('<Leave>', self.hover_off) self.ctl_3.pack(side='right') ##frame middle 1.7 f1_7 = tk.Frame(self) f1_7.pack(padx=30, anchor='w') self.dis = tk.Message(f1_7, text="", justify='left', width=450) self.dis.pack() ##frame 2 f2 = tk.Frame(self) f2.pack(padx=60, anchor='w') self.label = tk.Label(f2, anchor="w", fg="white", bg="blue", text=start_bt_ms, width=45) self.label.pack() tk.Label(f2, anchor="w", text=" ", width=45).pack() ## frame last fb = tk.Frame(self) fb.pack(padx=60, pady=(0, 15), anchor='e') self.stb = tk.Button(fb, text='Keywords', height=1, width=6, default='active', command=self.click_ok) self.stb.pack(side='right') self.stb.bind("<Enter>", self.hover_on) self.stb.bind("<Leave>", self.hover_off) self.stb2 = tk.Button(fb, text='Manual', height=1, width=6, command=self.click_ok_manual) self.stb2.pack(side='right') self.stb2.bind("<Enter>", self.hover_on_manual) self.stb2.bind("<Leave>", self.hover_off) self.stb3 = tk.Button(fb, text='Quit...', height=1, width=6, command=self.click_cancel) self.stb3.pack(side='right')
def __init__(self, master): tk.Frame.__init__(self, master) self.pack() self.master.title("") self.master.resizable(False, False) self.master.tk_setPalette(background='#ececec') self.master.protocol('WM_DELETE_WINDOW', self.click_cancel) self.master.bind('<Return>', self.click_ok) self.master.bind('<Escape>', self.click_cancel) x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2 y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3 self.master.geometry("+{}+{}".format(x, y)) self.master.config(menu=tk.Menu(self)) tk.Message(self, text=greeting(), font='System 18 bold', justify='left', aspect=800).pack(pady=(5, 0)) tk.Message(self, text="Procedures in twiOpinion:", font='System 14 bold', justify='left', aspect=800).pack(pady=(5, 0)) ## frame last f1_5 = tk.Frame(self) f1_5.pack(padx=60, pady=10, anchor='w') self.var = tk.IntVar() tk.Label(f1_5, text='Select the function you want: ( •̀ .̫ •́ )✧').grid( row=0, column=0, columnspan=9, sticky='w') tk.Label(f1_5, text=' ').grid(row=1, column=0, columnspan=9, sticky='w') R1 = tk.Radiobutton(f1_5, text="Step 0. Twitter Accessing Setting", variable=self.var, value=1).grid(row=2, column=0, sticky='w') R2 = tk.Radiobutton(f1_5, text="Step 1. Crawling From Twitter", variable=self.var, value=2).grid(row=3, column=0, sticky='w') R3 = tk.Radiobutton(f1_5, text="Step 2. Labeling Tweets", variable=self.var, value=3).grid(row=4, column=0, sticky='w') R4 = tk.Radiobutton(f1_5, text="Step 3. Machine Learning", variable=self.var, value=4).grid(row=5, column=0, sticky='w') R5 = tk.Radiobutton(f1_5, text="Step 4. Twitter User Information", variable=self.var, value=5).grid(row=6, column=0, sticky='w') tk.Label(f1_5, text=' ').grid(row=7, column=0, columnspan=9, sticky='w') self.programOutput = tk.StringVar() tk.Label(f1_5, anchor="w", fg="white", bg="blue", textvariable=self.programOutput, width=35).grid(row=8, column=0, sticky='w') self.programOutput.set(start_bt_ms) fb = tk.Frame(self) fb.pack(padx=60, pady=(10, 15), anchor='e') self.stb = tk.Button(fb, text='Start !', height=1, width=6, default='active', command=self.click_ok) self.stb.pack(side='right') self.stb.bind("<Enter>", self.hover_on) self.stb.bind("<Leave>", self.hover_off) self.stb2 = tk.Button(fb, text='Quit...', height=1, width=6, command=self.click_cancel) self.stb2.pack(side='right', padx=10)
def __init__(self, master): tk.Frame.__init__(self, master) self.pack() self.master.title("") self.master.resizable(False, False) self.master.tk_setPalette(background='#ececec') self.master.protocol('WM_DELETE_WINDOW', self.click_cancel) self.master.bind('<Return>', self.click_ok) self.master.bind('<Escape>', self.click_cancel) x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2 y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3 self.master.geometry("+{}+{}".format(x, y)) self.master.config(menu=tk.Menu(self)) tk.Message(self, text=greeting(), font='System 18 bold', justify='left', aspect=800).pack(pady=(5, 0)) tk.Message(self, text="Step 3. Learning", font='System 14 bold', justify='left', aspect=800).pack(pady=(5, 0)) ## frame 1 f1 = tk.Frame(self) f1.pack(padx=60, pady=10, anchor='w') tk.Label( f1, text= 'The folder you stored labeled data (blank default as ./output):' ).grid(row=0, column=0, columnspan=9, sticky='w') tk.Label(f1, text='Path:').grid(row=1, column=0, sticky='w') self.user_input = tk.Entry(f1, background='white', width=30) self.user_input.insert(0, "./output") self.user_input.grid(row=1, column=1, columnspan=4, sticky='w') tk.Label(f1, text=' ').grid(row=2, column=0, sticky='w') tk.Label(f1, text='The file containing unlabeled tweets you hope to learn:' ).grid(row=3, column=0, columnspan=9, sticky='w') tk.Label(f1, text='File:').grid(row=4, column=0, sticky='w') self.pass_input = tk.Entry(f1, background='white', width=30) self.pass_input.insert(0, "./output/unknown.txt") self.pass_input.grid(row=4, column=1, columnspan=4, sticky='w') tk.Label(f1, text=' ').grid(row=5, column=0, sticky='w') tk.Label( f1, text= 'Number of labeled and unlabeled tweets (blank default as maximum):' ).grid(row=6, column=0, columnspan=5, sticky='w') tk.Label(f1, text='Labeled:').grid(row=7, column=0, sticky='w') self.pass_inputL = tk.Entry(f1, background='white', width=10) self.pass_inputL.insert(0, "6000") self.pass_inputL.grid(row=7, column=1, sticky='w') tk.Label(f1, text='Unlabeled:').grid(row=7, column=2, sticky='w') self.pass_inputR = tk.Entry(f1, background='white', width=10) self.pass_inputR.insert(0, "5000") self.pass_inputR.grid(row=7, column=3, sticky='w') #buttons at bottom self.radio_var = tk.IntVar() print self.radio_var.get() f1_5 = tk.Frame(self) f1_5.pack(padx=60, pady=(5, 10), anchor='w') tk.Label(f1_5, text='Select a machine learning algorithm:').grid( row=0, column=0, columnspan=9, sticky='w') tk.Radiobutton(f1_5, text="Support Vector Machine", value=1, command=self.r1, indicatoron=0).grid(row=1, column=0) tk.Radiobutton(f1_5, text="Naive Bayes", value=2, command=self.r2, indicatoron=0).grid(row=1, column=1) tk.Radiobutton(f1_5, text="Decision Tree", value=3, command=self.r3, indicatoron=0).grid(row=1, column=2) ##frame 2 f2 = tk.Frame(self) f2.pack(padx=60, pady=(10, 10), anchor='w') self.label1 = tk.Label(f2, anchor="w", fg="white", bg="blue", text=start_bt_ms, width=45) self.label1.pack() self.label2 = tk.Label(f2, anchor="w", fg="black", bg="cyan", text=next_bt_ms, width=45) self.label2.pack() fb = tk.Frame(self) fb.pack(padx=60, pady=(0, 15), anchor='e') self.stb = tk.Button(fb, text='Learn !', height=1, width=6, default='active', command=self.click_ok) self.stb.pack(side='right') self.stb.bind("<Enter>", self.hover_on) self.stb.bind("<Leave>", self.hover_off) self.stb2 = tk.Button(fb, text='FileInfo', height=1, width=6, command=self.click_info) self.stb2.pack(side='right', padx=5) self.stb3 = tk.Button(fb, text='Quit...', height=1, width=6, command=self.click_cancel) self.stb3.pack(side='right')
def __init__(self, master): tk.Frame.__init__(self, master) self.pack() self.master.title("") self.master.resizable(False, False) self.master.tk_setPalette(background='#ececec') self.master.protocol('WM_DELETE_WINDOW', self.click_cancel) self.master.bind('<Return>', self.click_ok) self.master.bind('<Escape>', self.click_cancel) x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2 y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3 self.master.geometry("+{}+{}".format(x, y)) self.master.config(menu=tk.Menu(self)) tk.Message(self, text= greeting(), font='System 18 bold', justify='left', aspect=800).pack(pady=(5, 0)) tk.Message(self, text= "Step 1. Crawling", font='System 14 bold', justify='left', aspect=800).pack(pady=(5, 0)) ## frame 1 f1 = tk.Frame(self) f1.pack(padx=60, pady=15, anchor='w') self.f1l1 = tk.Label(f1, text='The tag or keyword you wish to grab from Twitter:') self.f1l1.grid(row=0,column=0,columnspan=2,sticky='w') self.f1l1L = tk.Label(f1, text='Keyword:') self.f1l1L.grid(row=1, column=0, sticky='w') self.user_input = tk.Entry(f1, background='white', width=30) self.user_input.grid(row=1, column=1, sticky='w') tk.Label(f1, text=' ').grid(row=2, column=0, sticky='w') self.f1l2 = tk.Label(f1, text='The folder you wish to store data (default as ./output):') self.f1l2.grid(row=3,column=0,columnspan=2,sticky='w') self.f1l2L = tk.Label(f1, text='Path:') self.f1l2L.grid(row=4, column=0, sticky='w') self.pass_input = tk.Entry(f1, background='white', width=30) self.pass_input.insert(0,"./output") self.pass_input.grid(row=4, column=1, sticky='w') ##frame middle 1.5 f1_5 = tk.Frame(self) f1_5.pack(padx=60, pady=(5,10), anchor='w') self.ctl_tx = tk.Label(f1_5, anchor="w",fg='black',state='disabled', text="Control crawling by following buttons after started:",width=45) self.ctl_tx.pack() self.ctl_1 = tk.Button(f1_5, text='Stop', height=1, width=6, state='disabled', command=self.click_1) self.ctl_1.bind('<Enter>', self.hover_1) self.ctl_1.bind('<Leave>', self.hover_off) self.ctl_1.pack(side='right') self.ctl_2 = tk.Button(f1_5, text='Fetch', height=1, width=6, state='disabled', command=self.click_2) self.ctl_2.bind('<Enter>', self.hover_2) self.ctl_2.bind('<Leave>', self.hover_off) self.ctl_2.pack(side='right') self.ctl_3 = tk.Button(f1_5, text='Check', height=1, width=6, state='disabled', command=self.click_3) self.ctl_3.bind('<Enter>', self.hover_3) self.ctl_3.bind('<Leave>', self.hover_off) self.ctl_3.pack(side='right') ##frame 2 f2 = tk.Frame(self) f2.pack(padx=60, pady=(10,10), anchor='w') self.label = tk.Label(f2, anchor="w",fg="white",bg="blue", text=start_bt_ms, width=45) self.label.pack() tk.Label(f2, anchor="w",text=" ", width=45).pack() ## frame last fb = tk.Frame(self) fb.pack(padx=60, pady=(0, 15), anchor='e') self.stb = tk.Button(fb, text='Start !', height=1, width=6, default='active', command=self.click_ok) self.stb.pack(side='right') self.stb.bind("<Enter>", self.hover_on) self.stb.bind("<Leave>", self.hover_off) self.stb2 = tk.Button(fb, text='Quit...', height=1, width=6, command=self.click_cancel) self.stb2.pack(side='right', padx=10)
def __init__(self, master): tk.Frame.__init__(self, master) self.pack() self.master.title("") self.master.resizable(False, False) self.master.tk_setPalette(background='#ececec') self.master.protocol('WM_DELETE_WINDOW', self.click_cancel) self.master.bind('<Return>', self.click_ok) self.master.bind('<Escape>', self.click_cancel) x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2 y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3 self.master.geometry("+{}+{}".format(x, y)) self.master.config(menu=tk.Menu(self)) tk.Message(self, text=greeting(), font='System 18 bold', justify='left', aspect=800).pack(pady=(5, 0)) tk.Message(self, text="Step 0. Twitter Accessing Setting", font='System 14 bold', justify='left', aspect=800).pack(pady=(5, 0)) ## frame 1 f1 = tk.Frame(self) f1.pack(padx=60, pady=15, anchor='w') tk.Label(f1, text='Your consumer key and secret:').grid(row=0, column=0, columnspan=2, sticky='w') tk.Label(f1, text='Consumer key:').grid(row=1, column=0, sticky='w') self.l1 = tk.Entry(f1, background='white', width=30) self.l1.grid(row=1, column=1, sticky='w') tk.Label(f1, text='Consumer secret:').grid(row=2, column=0, sticky='w') self.l2 = tk.Entry(f1, background='white', width=30) self.l2.grid(row=2, column=1, sticky='w') tk.Label(f1, text=' ').grid(row=3, column=0, sticky='w') tk.Label(f1, text='Your access token and secret:').grid(row=4, column=0, columnspan=2, sticky='w') tk.Label(f1, text='Access token:').grid(row=5, column=0, sticky='w') self.l3 = tk.Entry(f1, background='white', width=30) self.l3.grid(row=5, column=1, sticky='w') tk.Label(f1, text='Access secret:').grid(row=6, column=0, sticky='w') self.l4 = tk.Entry(f1, background='white', width=30) self.l4.grid(row=6, column=1, sticky='w') ##frame 2 f2 = tk.Frame(self) f2.pack(padx=60, pady=30, anchor='w') self.label = tk.Label(f2, anchor="w", fg="white", bg="blue", text=start_bt_ms, width=45) self.label.pack() ## frame last fb = tk.Frame(self) fb.pack(padx=60, pady=(0, 15), anchor='e') self.stb = tk.Button(fb, text='Start !', height=1, width=6, default='active', command=self.click_ok) self.stb.pack(side='right') self.stb.bind("<Enter>", self.hover_on) self.stb.bind("<Leave>", self.hover_off) self.stb2 = tk.Button(fb, text='Quit...', height=1, width=6, command=self.click_cancel) self.stb2.pack(side='right', padx=10)