예제 #1
0
def search():
    print searchEntry.get()
    if searchEntry.get() == "":
        status_text.set("Please enter keyword")
        return
    status_text.set("Loading keywords' list")
    lists = twitter_trends.queries_for_keyword(searchEntry.get())
    print lists
    status_text.set("predicting")
    percentage_list = load_test.predictTheResult(lists)
    print percentage_list
    initial = 0
    red_area = 360 * percentage_list[0]
    blue_area = 360 * percentage_list[1]
    green_area = 360 * percentage_list[2]
    status_text.set("drawing")
    if red_area == 360 or blue_area == 360 or green_area == 360:
        convas.create_arc(coord, style="chord", fill="red", start=0, extent=red_area)
        convas.create_arc(coord, style="chord", fill="blue", start=red_area, extent=blue_area)
        convas.create_arc(coord, style="chord", fill="green", start=red_area + blue_area, extent=green_area)
    convas.create_arc(coord, fill="red", start=0, extent=red_area)
    convas.create_arc(coord, fill="blue", start=red_area, extent=blue_area)
    convas.create_arc(coord, fill="green", start=red_area + blue_area, extent=green_area)
    status_text.set("done")
    percents = [
        int(float(percentage_list[0] * 100)),
        int(float(percentage_list[1] * 100)),
        int(float(percentage_list[2] * 100)),
    ]
    result_label_text.set(
        "%d percent people think it is good\n%d percent people think it is bad\n%d percent people think it is neutral"
        % (percents[0], percents[1], percents[2])
    )
예제 #2
0
def search():
	print searchEntry.get()
	if searchEntry.get()=="":
		status_text.set("Please enter keyword")
	status_text.set("Loading keywords' list")
	lists = twitter_trends.queries_for_keyword(searchEntry.get())
	print lists
	status_text.set("predicting")
	percentage_list = load_test.predictTheResult(lists)
	print percentage_list
	initial = 0
	red_area = 360*percentage_list[0]
	blue_area = 360*percentage_list[1]
	green_area = 360*percentage_list[2]
	purple_area = 360*percentage_list[3]
	orange_area = 360*percentage_list[4]
	snow_area = 360*percentage_list[5]
	status_text.set("drawing")
	convas.create_arc(coord, fill="red", start=0, extent = red_area)
	convas.create_arc(coord, fill="blue", start=red_area, extent =blue_area)
	convas.create_arc(coord, fill="green", start=red_area+blue_area, extent =green_area)
	convas.create_arc(coord, fill='purple', start=red_area+blue_area+green_area, extent =purple_area)
	convas.create_arc(coord, fill="orange", start=red_area+blue_area+green_area+purple_area, extent = orange_area)
	convas.create_arc(coord, fill="snow", start=red_area+blue_area+green_area+purple_area+orange_area, extent = snow_area)
	status_text.set("done")