Ejemplo n.º 1
0
def mouse_press(x, y, text, color, quiz_type):
    check = [x, y]
    for i in range(4):
        if is_inside(check, shapes[i]["rect"]) == True:
            mean_color = [shapes[i]["text"], shapes[i]["color"]]
    if quiz_type == 0:
        if mean_color[0] == text:
            return True
        else:
            return False
    elif quiz_type == 1:
        if mean_color[1] == color:
            return True
        else:
            return False
    return True
Ejemplo n.º 2
0
def mouse_press(x, y, text, color, quiz_type):

    pos = [x, y]
    for i in range(4):
        if is_inside(pos, shapes[i]["rect"]) == True:
            user_answer = [shapes[i]["text"], shapes[i]["color"]]
    if quiz_type == 0:
        if user_answer[0] == text:
            return True
        else:
            return False
    else:
        if user_answer[1] == color:
            return True
        else:
            return False
Ejemplo n.º 3
0
def mouse_press(x, y, text, color, quiz_type):
    shapes = get_shapes()

    for shape in shapes:

        if is_inside([x, y], shape['rect']):
            if quiz_type == 0:
                if text == shape['text']:
                    return True
                else:
                    return False
            elif quiz_type == 1:
                if color == shape['color']:
                    return True
                else:
                    return False
Ejemplo n.º 4
0
def mouse_press(x, y, text, color, quiz_type):
    check = True
    while check:
        for item in shapes:
            rect = item['rect']
            check = is_inside([x, y], rect)
            if check == True:
                box_color = item['color']
                text_color = item['text']
            else:
                break
    if quiz_type == 0 and text_color == text:
        check = True
    elif quiz_type == 1 and box_color == color:
        check = True
    else:
        check = False
    return check
Ejemplo n.º 5
0
def mouse_press(x, y, text, color, quiz_type):

    for shape in shapes:
        if is_inside([x, y], shape['rect']):
            dat_text = shape['text']
            dat_color = shape['color']
    if quiz_type == 0:
        if dat_text == text:
            return True
        else:
            return False
    if quiz_type == 1:
        if dat_color == color:
            return True
        else:
            return False

    return True
from is_inside import is_inside

check = is_inside([200, 120], [140, 60, 100, 200])

print(check)