Esempio n. 1
1
def main():
    points = [Point(x=230, y=450), Point(x=240, y=460), Point(x=230, y=470), Point(x=240, y=480)]
    polygon(point_list=points)
    points2 = [Point(p.x + 20, p.y + 20) for p in points]
    lines(point_list=points2, color=COLOR_DARK_ORANGE)
    line(start_point=Point(x=20, y=20), end_point=Point(x=40, y=300))
    square(left_bottom=Point(400, 300, ), side=100)
    rectangle(
        left_bottom=Point(x=200, y=200),
        right_top=Point(x=300, y=300),
        color=COLOR_DARK_GREEN
    )
    rectangle(
        left_bottom=Point(x=400, y=300),
        right_top=Point(x=300, y=400),
        color=COLOR_DARK_GREEN
    )
    sleep(2)
    clear_screen()
    vector(start=Point(x=230, y=260), angle=70, length=200, color=COLOR_PURPLE)
    for i in range(10):
        point = random_point()
        color = random_color()
        radius = random_number(20, 60)
        circle(center_position=point, radius=radius, color=color, width=0)
    sleep(2)
    clear_screen()
    for i in range(10):
        point = random_point()
        color = random_color()
        dx = random_number(30, 100)
        dy = random_number(30, 100)
        right_top = Point(x=point.x + dx, y=point.y + dy)
        ellipse(left_bottom=point, right_top=right_top, color=color)
    v3 = Vector(start_point=Point(0, 0), direction=45, length=50)
    for direction in range(0, 181, 20):
        v = Vector(start_point=Point(x=300, y=300), direction=direction, length=100)
        v.draw()
        v2 = Vector(start_point=v.end_point, direction=direction + 30, length=50)
        v2.draw(color=COLOR_GREEN)
        v2.add(v3)
        v2.draw(color=COLOR_ORANGE)
    snowflake(center=Point(), length=60, factor_b=0.2, factor_c=100)
    sleep(2)
    for k in range(2):
        y = 500
        for i in range(10):
            clear_screen()
            y -= 30
            for x in [100, 200, 300, 400, 500]:
                radius = random_number(30, 50)
                point = Point(x=x, y=y)
                snowflake(center=point, length=radius)
                mouse_point, mouse_buttons = get_mouse_state()
                print("mouse_state is {} + {}".format(mouse_point, mouse_buttons))
            if user_want_exit(sleep_time=0.1):
                break
        if user_want_exit(0):
            break
Esempio n. 2
0
def house():
    point_list_1 = []

    point_list_1.append(sd.get_point(230, 380))
    point_list_1.append(sd.get_point(475, 480))
    point_list_1.append(sd.get_point(720, 380))
    left_bot = sd.get_point(0, 0)
    right_top = sd.get_point(1200, 80)
    start_point = sd.get_point(250, 80)
    end_point = sd.get_point(700, 80)
    end_point_1 = sd.get_point(700, 380)

    sd.rectangle(left_bottom=left_bot, right_top=right_top, color=sd.COLOR_DARK_ORANGE, width=0)  # Земля

    v1 = sd.vector(start=start_point, angle=90, length=300, color=sd.COLOR_YELLOW, width=2)
    v2 = sd.vector(start=end_point, angle=90, length=300, color=sd.COLOR_YELLOW, width=2)
    v3 = sd.vector(start=end_point_1, angle=180, length=450, color=sd.COLOR_YELLOW, width=2)
    v4 = sd.vector(start=start_point, angle=0, length=450, color=sd.COLOR_YELLOW, width=2)

    wall(x_start=300, x_end=650, y_start=80, y_end=380, color=sd.COLOR_YELLOW)

    sd.square(left_bottom=sd.get_point(400, 145), side=150, color=sd.background_color, width=0)

    sd.square(left_bottom=sd.get_point(400, 145), side=150, color=sd.COLOR_YELLOW, width=2)

    sd.polygon(point_list=point_list_1, color=sd.COLOR_RED, width=0)
Esempio n. 3
0
def smile():
    sd.circle(center_position=point,
              radius=radius,
              color=sd.COLOR_YELLOW,
              width=0)
    # рисуем глаза
    left_eye = sd.get_point(x - 20, y + 12)
    right_eye = sd.get_point(x + 20, y + 12)
    for colors in color:
        sd.circle(left_eye, radius=4, color=colors, width=0)
        sd.circle(right_eye, radius=4, color=colors, width=0)
    a = color[0]
    color.remove(a)
    color.append(a)

    # рисуем нос
    nose_start = sd.get_point(x, y + 10)
    nose_finish = sd.get_point(x, y - 10)
    sd.line(nose_start, nose_finish, color=sd.COLOR_BLACK, width=2)
    # рисуем рот
    point_list = [
        sd.get_point(x - 24, y - 30),
        sd.get_point(x, y - 20),
        sd.get_point(x + 24, y - 30)
    ]
    sd.polygon(point_list=point_list, color=sd.COLOR_BLACK, width=0)
    glosso_point = sd.get_point(x, y - 35)
    for glcolors in glosso_color:
        sd.circle(glosso_point, radius=5, color=glcolors, width=0)
    b = glosso_color[0]
    glosso_color.remove(b)
    glosso_color.append(b)
Esempio n. 4
0
def draw_roof(x0, y0, height_wall, width_wall, COLOR):
    points = [
        sd.Point(x=x0 - width_wall / 4, y=y0 + height_wall),
        sd.Point(x=x0 + width_wall / 2, y=y0 + 1.8 * height_wall),
        sd.Point(x=x0 + 5 * width_wall / 4, y=y0 + height_wall)
    ]
    sd.polygon(point_list=points, color=COLOR, width=0)
Esempio n. 5
0
def draw_roof(start_point, length_grounds, angle, color=sd.COLOR_DARK_RED):
    point_1 = start_point
    point_2 = sd.get_point(start_point.x + length_grounds, start_point.y)
    point_3 = sd.get_point(
        start_point.x + length_grounds / 2,
        start_point.y + (length_grounds / 2) / sd.cos(angle))
    sd.polygon(point_list=[point_1, point_2, point_3], width=0, color=color)
Esempio n. 6
0
def roof(begin, end, height):
    points_list = []
    points_list.append(sd.get_point(begin['x'], begin['y']))
    points_list.append(sd.get_point(end['x'], end['y']))
    points_list.append(
        sd.get_point((end['x'] + begin['x']) / 2, end['y'] + height))
    sd.polygon(point_list=points_list, color=(59, 15, 15), width=0)
Esempio n. 7
0
def triangle(point, angle, lenght, color):
    point_list = [
        point,
        sd.get_point(point.x + 410, point.y),
        sd.get_point(point.x + 205, point.y + 50)
    ]
    sd.polygon(point_list, color, width=0)
Esempio n. 8
0
def first_screen():
    points = [
        sd.Point(x=230, y=450),
        sd.Point(x=240, y=460),
        sd.Point(x=230, y=470),
        sd.Point(x=240, y=480),
    ]
    sd.polygon(point_list=points)
    points2 = [sd.Point(p.x + 20, p.y + 20) for p in points]
    sd.lines(point_list=points2, color=sd.COLOR_DARK_ORANGE, width=2)
    sd.line(start_point=sd.Point(x=20, y=20),
            end_point=sd.Point(x=40, y=300),
            width=2)
    sd.square(left_bottom=sd.Point(
        400,
        300,
    ), side=100, width=2)
    sd.rectangle(
        left_bottom=sd.Point(x=200, y=200),
        right_top=sd.Point(x=300, y=300),
        color=sd.COLOR_DARK_GREEN,
        width=2,
    )
    sd.rectangle(
        left_bottom=sd.Point(x=400, y=300),
        right_top=sd.Point(x=300, y=400),
        color=sd.COLOR_DARK_GREEN,
        width=2,
    )
    if TAKE_SNAPSHOTS:
        sd.take_snapshot(path=SNAPSHOTS_PATH)
Esempio n. 9
0
def _draw_roof(center_x, y, width, height, color=simple_draw.COLOR_YELLOW):
    """Отрисовка треугольной крыши дома

    Parameters
    ----------
    center_x, y: int
        Центральная нижняя точка крыши (середина основания треугольника)

    width: int
        Ширина крыши

    height: int
        Высота крыши

    color: tuple(int, int, int), default=(255, 255, 0)
        Цвет крыши. Это кортеж (red, green, blue),
        где для каждый из трёх элементов цвета принимает значения от 0 до 255 включительно

    """
    points = [
        simple_draw.get_point(center_x - width // 2, y),
        simple_draw.get_point(center_x + width // 2, y),
        simple_draw.get_point(center_x, y + height),
    ]
    simple_draw.polygon(points, color=color, width=0)
def my_clear_screen(color):
    # print(color)

    screen_point = (sd.get_point(0, 0), sd.get_point(0, sd.resolution[0]),
                    sd.get_point(sd.resolution[0], sd.resolution[1]),
                    sd.get_point(sd.resolution[0], 0))

    sd.polygon(screen_point, color, width=0)
Esempio n. 11
0
def roof():
    point = [
        sd.get_point(0, 250),
        sd.get_point(200, 250),
        sd.get_point(600, 250),
        sd.get_point(300, 450)
    ]
    sd.polygon(point_list=point, color=sd.COLOR_WHITE, width=0)
Esempio n. 12
0
def window():
    point = [
        sd.get_point(200, 100),
        sd.get_point(200, 200),
        sd.get_point(300, 200),
        sd.get_point(300, 100)
    ]
    sd.polygon(point_list=point, color=sd.COLOR_WHITE, width=0)
Esempio n. 13
0
def ground(high=45):
    point1 = sd.get_point(-1, -1)
    point2 = sd.get_point(2000, -1)
    point3 = sd.get_point(2000, high)
    point4 = sd.get_point(-1, high)

    point_list = [point1, point2, point3, point4]

    sd.polygon(point_list=point_list, width=0, color=sd.COLOR_DARK_GREEN)
Esempio n. 14
0
def sleeve(start_point, angle, angle2, length, width, color1, color2):
    # для наглядности http://joxi.ru/krDajB4IJ8Qkgm
    angle_rad = math.radians(angle)
    angle2_rad = math.radians(angle2)
    real_start = sd.get_point(start_point.x + width / 2 * math.sin(angle_rad),
                              start_point.y - width / 2 * math.cos(angle_rad))
    joint_center = sd.get_point(start_point.x + length * math.cos(angle_rad),
                                start_point.y + length * math.sin(angle_rad))
    a1_point = start_point
    a_point = sd.get_point(real_start.x - width * math.sin(angle_rad), real_start.y + width * math.cos(angle_rad))
    # пересчет точки B в зависимости от угла сгиба руки
    if angle2 - angle > 10:
        angle_b = angle + (angle2 - angle) / 10
        angle_b_rad = math.radians(angle_b)
        b_point = sd.get_point(a_point.x + length / 2 * math.cos(angle_b_rad),
                               a_point.y + length / 2 * math.sin(angle_b_rad))
    else:
        b_point = sd.get_point(a_point.x + length / 2 * math.cos(angle_rad),
                               a_point.y + length / 2 * math.sin(angle_rad))

    d_point = sd.get_point(joint_center.x - width / 2 * math.sin(angle2_rad) + length * math.cos(angle2_rad),
                           joint_center.y + width / 2 * math.cos(angle2_rad) + length * math.sin(angle2_rad))
    e_point = sd.get_point(d_point.x + width * math.sin(angle2_rad), d_point.y - width * math.cos(angle2_rad))
    g_point = real_start
    # пересчет точки C в зависимости от угла сгиба руки
    if angle2 - angle > 2:
        angle_c = angle - (angle2 - angle) / 5
        angle_c_rad = math.radians(angle_c)
        c1_point = sd.get_point(b_point.x + length / 2 * math.cos(angle_c_rad),
                                b_point.y + length / 2 * math.sin(angle_c_rad))
    else:
        c1_point = sd.get_point(b_point.x + length / 2 * math.cos(angle_rad),
                                b_point.y + length / 2 * math.sin(angle_rad))
    c2_point = sd.get_point(d_point.x - length * math.cos(angle2_rad), d_point.y - length * math.sin(angle2_rad))
    if angle2 == 0:
        c_point = c1_point

    elif angle2 == 90:
        c_point = c2_point
    else:
        c_points = joint_point(b_point, c1_point, d_point, c2_point)
        c_point = sd.get_point(c_points[0], c_points[1])

    f1_point = sd.get_point(e_point.x - length * math.cos(angle2_rad), e_point.y - length * math.sin(angle2_rad))
    f2_point = sd.get_point(real_start.x + length * math.cos(angle_rad), real_start.y + length * math.sin(angle_rad))
    if angle2 == 0:
        f_point = f1_point
    elif 89 < angle < 90:
        f_point = f1_point
    else:
        f_points = joint_point(e_point, f1_point, g_point, f2_point)
        f_point = sd.get_point(f_points[0], f_points[1])

    contur = (a1_point, a_point, b_point, c_point, d_point, e_point, f_point, g_point)
    sd.polygon(contur, color=color1, width=0)
    sd.lines(contur, color=color2, closed=True, width=2)
Esempio n. 15
0
def house():
    # рисуем дом с окном, без крыши, раскрашиваем в кирпич
    house_x = 220
    house_y = 10
    ground_start_x = 0
    ground_start_y = 0
    ground_finish_x = 1200
    ground_finish_y = 50

    start_house_point = sd.get_point(house_x, house_y)
    start_ground_point = sd.get_point(ground_start_x, ground_start_y)
    finish_ground_point = sd.get_point(ground_finish_x, ground_finish_y)
    sd.rectangle(start_ground_point,
                 finish_ground_point,
                 sd.COLOR_GREEN,
                 width=0)
    sd.square(left_bottom=start_house_point,
              side=350,
              color=sd.COLOR_DARK_ORANGE,
              width=0)
    sd.square(left_bottom=start_house_point,
              side=350,
              color=sd.COLOR_WHITE,
              width=2)

    def draw_briks(start, finish):
        for house_x in range(start, finish, 50):
            start_point = sd.get_point(house_x, house_y)
            end_point = sd.get_point(house_x + 50, house_y + 25)
            sd.rectangle(start_point, end_point, color=sd.COLOR_WHITE, width=2)

    for row, house_y in enumerate(range(10, 350, 25)):
        if row % 2 != 0:
            draw_briks(220, 570)
        else:
            draw_briks(245, 545)

    window_x = 300
    window_y = 85

    start_window_point = sd.get_point(window_x, window_y)
    sd.square(left_bottom=start_window_point,
              side=200,
              color=sd.COLOR_BLUE,
              width=0)
    sd.square(left_bottom=start_window_point,
              side=200,
              color=sd.COLOR_WHITE,
              width=2)

    # рисуем треугольную крышу дома
    roof_point = (sd.get_point(220,
                               360), sd.get_point(570,
                                                  360), sd.get_point(395, 500))
    sd.polygon(roof_point, color=sd.COLOR_DARK_RED, width=0)
Esempio n. 16
0
 def draw_saddle(self):
     points_saddle = [
         sd.get_point(self.pos_saddle.x, self.pos_saddle.y + 20),
         sd.get_point(self.pos_saddle.x - 15, self.pos_saddle.y + 35),
         sd.get_point(self.pos_saddle.x + 50, self.pos_saddle.y + 35)
     ]
     sd.line(self.pos_saddle,
             points_saddle[0],
             color=sd.COLOR_BLUE,
             width=10)
     sd.polygon(point_list=points_saddle, color=sd.COLOR_BLACK, width=15)
Esempio n. 17
0
def house():
    left_bottom_perimeter = sd.get_point(300, 35)
    right_top_perimeter = sd.get_point(510, 215)
    sd.rectangle(left_bottom_perimeter, right_top_perimeter, sd.COLOR_DARK_RED, 0)

    left_bottom_foundation = sd.get_point(285, 0)
    right_top_foundation = sd.get_point(525, 35)
    sd.rectangle(left_bottom_foundation, right_top_foundation, sd.COLOR_ORANGE, 0)

    point_list = (sd.get_point(285, 215), sd.get_point(525, 215), sd.get_point(410, 430))
    sd.polygon(point_list, sd.COLOR_DARK_RED, width=0)
Esempio n. 18
0
def draw_house(_x=300, _y=10):
    brick_height = 10
    brick_length = 30
    brick_seam = 3
    house_length = brick_length * 9 + brick_seam * 8
    house_height = (brick_height + brick_seam) * 18
    brick_color = (136, 69, 53)
    seam_color = (104, 108, 94)
    bottom_point = sd.get_point(_x, _y)
    top_point = sd.get_point(x=_x + house_length, y=_y + house_height)
    sd.rectangle(left_bottom=bottom_point,
                 right_top=top_point,
                 color=brick_color)
    triangle = [
        sd.Point(_x - 50, _y + house_height),
        sd.Point(_x + house_length + 50, _y + house_height),
        sd.Point(_x + house_length // 2, _y + house_length),
    ]
    sd.polygon(point_list=triangle, width=0, color=seam_color)
    for y in range(house_height // (brick_height + brick_seam)):
        if y % 2 == 0:
            start_x = _x + brick_length
        else:
            start_x = _x + brick_length // 2
        if 0 < y <= house_height // (brick_height + brick_seam):
            line_point1 = sd.get_point(x=_x,
                                       y=_y + y * (brick_height + brick_seam))
            line_point2 = sd.get_point(x=_x + house_length - 1,
                                       y=_y + y * (brick_height + brick_seam))
            sd.line(start_point=line_point1,
                    end_point=line_point2,
                    color=seam_color,
                    width=brick_seam)
        for x in range(start_x, _x + house_length, brick_length + brick_seam):
            line_point1 = sd.get_point(x=x,
                                       y=_y + y * (brick_height + brick_seam))
            line_point2 = sd.get_point(x=x,
                                       y=_y + (y + 1) *
                                       (brick_height + brick_seam))
            sd.line(start_point=line_point1,
                    end_point=line_point2,
                    color=seam_color,
                    width=brick_seam)
    bottom_point = sd.get_point(x=_x + (brick_length + brick_seam) * 3 - 2,
                                y=_y + (brick_height + brick_seam) * 6 + 2)
    top_point = sd.get_point(x=_x + (brick_length + brick_seam) * 6,
                             y=_y + (brick_height + brick_seam) * 12)
    sd.rectangle(left_bottom=bottom_point,
                 right_top=top_point,
                 color=(157, 161, 170))
    sd.rectangle(left_bottom=bottom_point,
                 right_top=top_point,
                 color=(138, 102, 66),
                 width=4)
Esempio n. 19
0
def window_and_roof():

    points_for_roof = [
        sd.Point(350, 250),
        sd.Point(750, 250),
        sd.Point(550, 330)
    ]
    sd.lines(points_for_roof, width=0, closed=True)
    sd.rectangle(sd.Point(500, 110), sd.Point(600, 210), width=0)
    sd.polygon(points_for_roof, color=sd.COLOR_RED, width=0)
    sd.square(sd.Point(500, 110), 100, color=sd.COLOR_BLACK, width=4)
Esempio n. 20
0
def bone(start_point, angle, length, width, color1=sd.background_color, color2=sd.background_color):
    angle_rad = math.radians(angle)
    real_start = sd.get_point(start_point.x + width / 2 * math.sin(angle_rad),
                              start_point.y - width / 2 * math.cos(angle_rad))
    contur = (start_point, real_start,
              sd.get_point(real_start.x + length * math.cos(angle_rad), real_start.y + length * math.sin(angle_rad)),
              sd.get_point(real_start.x - width * math.sin(angle_rad) + length * math.cos(angle_rad),
                           real_start.y + width * math.cos(angle_rad) + length * math.sin(angle_rad)),
              sd.get_point(real_start.x - width * math.sin(angle_rad), real_start.y + width * math.cos(angle_rad))
              )
    sd.polygon(contur, color=color1, width=0)
    sd.lines(contur, color=color2, closed=True, width=2)
Esempio n. 21
0
    def draw_handlebar(self):
        pos_handlebar = sd.get_point(x=self.pos_wheel_front.x,
                                     y=self.pos_wheel_front.y +
                                     self.radius_front_wheel + 50)
        points_handlebar = [
            sd.get_point(pos_handlebar.x + 20, pos_handlebar.y + 20),
            sd.get_point(pos_handlebar.x - 60, pos_handlebar.y + 20)
        ]

        sd.line(pos_handlebar,
                sd.get_point(pos_handlebar.x, pos_handlebar.y + 20),
                color=sd.COLOR_BLUE,
                width=10)
        sd.polygon(point_list=points_handlebar, color=sd.COLOR_BLACK, width=15)
Esempio n. 22
0
def roof():
    sd.polygon(point_list=[
        sd.get_point(300, 400),
        sd.get_point(1200, 400),
        sd.get_point(750, 600)
    ],
               color=sd.COLOR_DARK_ORANGE,
               width=0)
    sd.polygon(point_list=[
        sd.get_point(300, 400),
        sd.get_point(1200, 400),
        sd.get_point(750, 600)
    ],
               color=sd.COLOR_BLACK,
               width=3)
Esempio n. 23
0
def draw_house(start_of_wall, end_of_wall, height_of_wall, height_brick=50):

    wall.paint_wall(start_of_wall=start_of_wall, end_of_wall=end_of_wall,
                    height_of_wall=height_of_wall, height_brick=height_brick)
    point_for_wall = sd.get_point(start_of_wall, 0)
    sd.vector(start=point_for_wall, angle=90, length=height_of_wall)
    point_for_wall = sd.get_point(end_of_wall+height_brick, 0)
    sd.vector(start=point_for_wall, angle=90, length=height_of_wall)

    point_for_window_left_bottom = sd.get_point((end_of_wall-start_of_wall)/2+start_of_wall-150, 100)
    point_for_window_right_top = sd.get_point((end_of_wall-start_of_wall)/2+start_of_wall+50, height_of_wall-50)
    sd.rectangle(point_for_window_left_bottom, point_for_window_right_top, width=0, color=sd.COLOR_BLUE)
    list_for_roof = [sd.get_point(start_of_wall-50, height_of_wall),
                     sd.get_point(end_of_wall+100, height_of_wall),
                     sd.get_point((end_of_wall-start_of_wall)/2+start_of_wall, height_of_wall+100)]
    sd.polygon(point_list=list_for_roof, color=sd.COLOR_BLUE, width=0)
Esempio n. 24
0
 def _draw_protec(self, center, radius, angle=0):
     step_angle = int(LENGTH_ARC_SEGMENT * 180 / PI / radius)
     for ang in range(0, 360, step_angle):
         point1 = self.get_point_from_angle(center=center,
                                            angle=angle + ang,
                                            radius=radius)
         point2 = self.get_point_from_angle(center=center,
                                            angle=angle + ang + 1,
                                            radius=radius + 2)
         point3 = self.get_point_from_angle(center=center,
                                            angle=angle + ang + 2,
                                            radius=radius + 2)
         point4 = self.get_point_from_angle(center=center,
                                            angle=angle + ang + 3,
                                            radius=radius)
         poly_line = [point1, point2, point3, point4]
         sd.polygon(point_list=poly_line, color=sd.COLOR_BLACK, width=3)
def draw_house():

    # рисуем стену здания
    pt_wall.draw_wall(pos_x=building_start_point.x,
                      pos_y=building_start_point.y)

    # рисуем крышу здания
    sd.polygon(point_list=roof_point_list, color=sd.COLOR_DARK_GREEN, width=0)
    sd.polygon(point_list=roof_point_list, color=sd.COLOR_BLACK, width=1)

    # рисуем окно на крыше
    sd.circle(sd.get_point(
        building_start_point.x + 1 + building_size[0] // 2,
        building_start_point.y + 1 + building_size[1] + building_size[1] // 2),
              30,
              color=sd.COLOR_DARK_YELLOW,
              width=0)

    sd.circle(sd.get_point(
        building_start_point.x + 1 + building_size[0] // 2,
        building_start_point.y + 1 + building_size[1] + building_size[1] // 2),
              30,
              color=sd.COLOR_BLACK,
              width=1)

    # рисуем окно здания
    x_step = building_size[0] // 4
    y_step = building_size[1] // 5

    sd.rectangle(sd.get_point(building_start_point.x + 1 + x_step,
                              building_start_point.y + 1 + y_step),
                 sd.get_point(
                     building_start_point.x + 1 + building_size[0] - x_step,
                     building_start_point.y + 1 + building_size[1] - y_step),
                 color=sd.COLOR_DARK_YELLOW,
                 width=0)

    sd.rectangle(sd.get_point(building_start_point.x + 1 + x_step,
                              building_start_point.y + 1 + y_step),
                 sd.get_point(
                     building_start_point.x + 1 + building_size[0] - x_step,
                     building_start_point.y + 1 + building_size[1] - y_step),
                 color=sd.COLOR_BLACK,
                 width=3)
Esempio n. 26
0
def smile(add_wink):
    i = 0
    while i < 2:
        x = 425
        y = 130
        point_smile = sd.get_point(x, y)
        point_eyes_1 = sd.get_point(x - 6, y + 5)
        point_eyes_2 = sd.get_point(x + 6, y + 5)
        color_smile = sd.COLOR_BLACK
        color_eyes_lips = sd.COLOR_WHITE
        radius = 20
        sd.circle(point_smile, radius, color_smile, width=0)
        sd.circle(point_eyes_1, 2, color_eyes_lips, width=1)
        if add_wink < 3:
            sd.line(sd.get_point(x, y + 5),
                    sd.get_point(x + 10, y + 5),
                    color_eyes_lips,
                    width=1)
        else:
            sd.circle(point_eyes_2, 2, color_eyes_lips, width=1)
        start_point1 = sd.get_point(x - 4, y - 6)
        end_point1 = sd.get_point(x - 3, y - 5)
        start_point2 = sd.get_point(x - 3, y - 5)
        end_point2 = sd.get_point(x + 3, y - 5)
        start_point3 = sd.get_point(x + 3, y - 5)
        end_point3 = sd.get_point(x + 4, y - 6)
        sd.line(start_point1, end_point1, color_eyes_lips, 1)
        sd.line(start_point2, end_point2, color_eyes_lips, 1)
        sd.line(start_point3, end_point3, color_eyes_lips, 1)

        point_list1 = (sd.get_point(x - 17,
                                    y + 12), sd.get_point(x - 9, y + 18),
                       sd.get_point(x - 17, y + 35))
        sd.polygon(point_list1, sd.COLOR_BLACK, width=0)
        point_list2 = (sd.get_point(x + 17,
                                    y + 2), sd.get_point(x + 9, y + 18),
                       sd.get_point(x + 17, y + 35))
        sd.polygon(point_list2, sd.COLOR_BLACK, width=0)

        sd.rectangle(sd.get_point(402, 78), sd.get_point(448, 115),
                     sd.COLOR_BLACK)
        i += 1
Esempio n. 27
0
def house():
    # roof
    point_list = [sd.get_point(350, 237), sd.get_point(695, 237), sd.get_point(520, 338), sd.get_point(350, 238)]
    sd.polygon(point_list=point_list, color=sd.COLOR_DARK_ORANGE, width=0)
    # window
    window_point = sd.get_point(465, 72)
    sd.square(left_bottom=window_point, side=110, color=sd.COLOR_WHITE, width=0)
    # outside walls
    square_point = sd.get_point(400, -5)
    sd.square(left_bottom=square_point, side=240, color=sd.COLOR_WHITE, width=1)
    # wall
    brick_x = 40
    brick_y = 20

    for row, y in enumerate(range(0, 220, 18)):
        x0 = 400 if row % 2 == 0 else 420
        for x in range(x0, 620, 40):
            left_bottom = sd.get_point(x, y)
            right_top = sd.get_point(x + brick_x, y + brick_y)
            sd.rectangle(left_bottom, right_top, color=sd.COLOR_WHITE, width=1)
Esempio n. 28
0
def house(color, start_x, start_y, side_y_size, side_x_size, brick_x_size,
          brick_y_size, width):
    import simple_draw as sd
    from village import wall

    # вызываем стену

    wall.wall(color=color,
              start_x=start_x,
              start_y=start_y,
              side_y_size=side_y_size,
              side_x_size=side_x_size,
              brick_x_size=brick_x_size,
              brick_y_size=brick_y_size,
              width=width)

    house_length = wall.wall_length[0]
    end_y_wall = wall.wall_length[1]

    # рисуем крышу
    point_1 = sd.get_point(x=start_x, y=end_y_wall + brick_y_size)
    point_2 = sd.get_point(x=start_x + house_length * .3,
                           y=side_y_size + +brick_y_size * 3)
    point_3 = sd.get_point(x=house_length, y=end_y_wall + brick_y_size)
    point_list = [point_1, point_2, point_3]
    sd.polygon(point_list=point_list, color=sd.COLOR_DARK_RED, width=0)

    # рисуем окно
    window_point = sd.get_point(x=side_x_size / 1.5, y=side_y_size / 2)
    sd.square(left_bottom=window_point,
              side=side_y_size / 3,
              color=sd.COLOR_WHITE,
              width=0)

    # рисуем землю
    point_1 = sd.get_point(x=0, y=0)
    point_2 = sd.get_point(x=0, y=100)
    point_3 = sd.get_point(x=sd.resolution[0], y=100)
    point_4 = sd.get_point(x=sd.resolution[0], y=0)
    point_list = [point_1, point_2, point_3, point_4]
    sd.polygon(point_list=point_list, color=sd.COLOR_DARK_ORANGE, width=0)
Esempio n. 29
0
def cat(x, y):
    sd.ellipse(left_bottom=sd.get_point(x - 40, y - 12), right_top=sd.get_point(x + 40, y + 16),
               color=sd.COLOR_BLACK)
    sd.ellipse(left_bottom=sd.get_point(x + 30, y - 50), right_top=sd.get_point(x + 40, y),
               color=sd.COLOR_BLACK)
    sd.circle(sd.get_point(x - 40, y + 12), radius=16, color=sd.COLOR_WHITE)
    sd.circle(sd.get_point(x - 40, y + 12), radius=15, color=sd.COLOR_BLACK, width=0)
    cat_ear = []
    cat_ear.append(sd.get_point(x - 43, y + 23))
    cat_ear.append(sd.get_point(x - 53, y + 23))
    cat_ear.append(sd.get_point(x - 47, y + 33))
    sd.polygon(cat_ear, color=sd.COLOR_BLACK, width=0)
    cat_ear = []
    cat_ear.append(sd.get_point(x - 30, y + 23))
    cat_ear.append(sd.get_point(x - 40, y + 23))
    cat_ear.append(sd.get_point(x - 35, y + 33))
    sd.polygon(cat_ear, color=sd.COLOR_BLACK, width=0)
    sd.circle(sd.get_point(x - 40, y + 12), radius=1, color=sd.COLOR_WHITE)
    sd.circle(sd.get_point(x - 45, y + 17), radius=2, color=sd.COLOR_BLUE)
    sd.circle(sd.get_point(x - 35, y + 18), radius=2, color=sd.COLOR_BLUE)
    sd.line(sd.get_point(x - 42, y + 6), sd.get_point(x - 38, y + 6))
Esempio n. 30
0
def smile(smile_point):
    # Радиус смайлика
    radius = 50

    # Радиус глаз
    eyes_radius = 10

    # Рисуем окружность для смайлика
    simple_draw.circle(center_position=smile_point, color=simple_draw.COLOR_YELLOW, radius=radius, width=0)

    # Рисуем глаза
    point1 = simple_draw.get_point(smile_point.x - 25, smile_point.y + 10)
    point2 = simple_draw.get_point(smile_point.x + 25, smile_point.y + 10)
    simple_draw.circle(center_position=point1, color=simple_draw.COLOR_DARK_PURPLE, radius=eyes_radius, width=0)
    simple_draw.circle(center_position=point2, color=simple_draw.COLOR_DARK_PURPLE, radius=eyes_radius, width=0)

    # Рисуем рот
    point3 = simple_draw.get_point(smile_point.x - 25, smile_point.y - 20)
    point4 = simple_draw.get_point(smile_point.x - 20, smile_point.y - 10)
    point5 = simple_draw.get_point(smile_point.x + 20, smile_point.y - 10)
    point6 = simple_draw.get_point(smile_point.x + 10, smile_point.y - 30)
    simple_draw.polygon(point_list=[point3, point4, point5, point6], color=simple_draw.COLOR_RED, width=2)
Esempio n. 31
0
def house():
    left_bottom = sd.get_point(375, 0)
    sd.square(left_bottom, side=350, color=sd.COLOR_DARK_RED, width=0)

    for row, y in enumerate(range(0, 350, 25)):
        x0 = 0 if row % 2 else -25  # Как вам такой приём? :)
        x1 = x0 + 400
        for x in range(x1, 700, 50):
            point1 = sd.get_point(x, y)
            point2 = sd.get_point(x + 50, y + 25)
            brick = sd.rectangle(point1,
                                 point2,
                                 width=1,
                                 color=(127, 127, 127))

    left_bottom = sd.get_point(475, 125)
    sd.square(left_bottom, side=150, color=sd.COLOR_BLACK, width=0)

    point1 = sd.get_point(350, 350)
    point2 = sd.get_point(550, 450)
    point3 = sd.get_point(750, 350)
    point_list = point1, point2, point3
    sd.polygon(point_list, color=sd.COLOR_DARK_ORANGE, width=0)