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
def printSmileRandom(): for _ in range(100): colorSmile = simple_draw.random_color() pointSmile = simple_draw.random_point() radiusSmile = 66 startPointX = pointSmile.x startPointY = pointSmile.y eyeLeft = simple_draw.get_point(startPointX - 20, startPointY + 20) eyeRight = simple_draw.get_point(startPointX + 20, startPointY + 20) eyeRadius = 6 lipCornerLeft = simple_draw.get_point(startPointX - 20, startPointY - 20) lipCornerRight = simple_draw.get_point(startPointX + 20, startPointY - 20) lipCornerCenter = simple_draw.get_point(startPointX, startPointY - 40) simple_draw.circle(pointSmile, radiusSmile, colorSmile, 2) simple_draw.circle(eyeLeft, eyeRadius, colorSmile, 2) simple_draw.circle(eyeRight, eyeRadius, colorSmile, 2) simple_draw.lines((lipCornerLeft, lipCornerCenter, lipCornerRight), colorSmile, True, 2)
def random_circles(): for i in range(100): point = sd.random_point() width = 2 radius = sd.random_number(a=width) sd.circle(center_position=point, radius=radius, color=sd.random_color(), width=width)
def second_screen(): sd.start_drawing() sd.vector(start=sd.Point(x=230, y=260), angle=70, length=200, color=sd.COLOR_PURPLE, width=2) for i in range(10): point = sd.random_point() color = sd.random_color() radius = sd.random_number(20, 60) sd.circle(center_position=point, radius=radius, color=color, width=0) sd.finish_drawing() if TAKE_SNAPSHOTS: sd.take_snapshot(file_name='second_screen.png', path=SNAPSHOTS_PATH)
def draw_snowfall(count=999, start_point=50, end_point=200, earth=100): snowfall_points_tuple = [] for i in range(count): snowfall_points_tuple.append( sd.get_point(sd.random_point().x, sd.resolution[1])) for _ in range(count): while True: if sd.user_want_exit(): break sd.snowflake(snowfall_points_tuple[_], 15) if snowfall_points_tuple[_].y < earth: break sd.snowflake(snowfall_points_tuple[_], 15, sd.background_color) snowfall_points_tuple[_].y -= 10
def third_screen(): for i in range(10): point = sd.random_point() color = sd.random_color() dx = sd.random_number(30, 100) dy = sd.random_number(30, 100) right_top = sd.Point(x=point.x + dx, y=point.y + dy) sd.ellipse(left_bottom=point, right_top=right_top, color=color) v3 = sd.Vector(start_point=sd.Point(0, 0), direction=90, length=50) for direction in range(0, 181, 20): v = sd.Vector(start_point=sd.Point(x=300, y=300), direction=direction, length=100) v.draw(width=3) v2 = sd.Vector(start_point=v.end_point, direction=direction + 30, length=50) v2.draw(color=sd.COLOR_GREEN, width=2) v2.add(v3) v2.draw(color=sd.COLOR_ORANGE) sd.snowflake(center=sd.Point(), length=60, factor_b=0.2, factor_c=100) if TAKE_SNAPSHOTS: sd.take_snapshot(path=SNAPSHOTS_PATH)
# Нарисовать 10 пузырьков в ряд x = 200 radius = 60 for _ in range(10): center = sd.get_point(x, 500) x += 100 bubble(center=center, radius=radius, color=(0, 255, 0), width=1, step=5) # Нарисовать три ряда по 10 пузырьков y = 100 radius = 40 for _ in range(3): x = 200 y += 70 for _ in range(10): center = sd.get_point(x, y) x += 100 bubble(center=center, radius=radius, color=(255, 0, 0), width=1, step=5) # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами for _ in range(100): center = sd.random_point() bubble(center=center, radius=40, color=0, width=1, step=4) sd.pause()
# которая возвращает функции рисования треугольника, четырехугольника, пятиугольника и т.д. # # Функция рисования должна принимать параметры # - точка начала рисования # - угол наклона # - длина стороны # # Функция-фабрика должна принимать параметр n - количество сторон. def get_polygon(n): def draw_shapes(point, angle=0, length=200, width=3): end_point = point for _ in range(n): vector = sd.get_vector(start_point=point, angle=angle, length=length, width=width) vector.draw() point = vector.end_point angle += 360 / n sd.line(point, end_point, width=width) return draw_shapes for draw_shape in [get_polygon(n) for n in range(1, 8)]: draw_shape(point=sd.random_point(), angle=42, length=100) sd.pause() #зачёт!
time.sleep(1) sd.clear_screen() # Нарисовать 10 пузырьков в ряд for x in range(100, 1001, 100): buble_position = sd.get_point(x, 500) draw_buble(position=buble_position, radius=30, color=sd.COLOR_YELLOW) time.sleep(1) sd.clear_screen() # # Нарисовать три ряда по 10 пузырьков for y in range(100, 301, 100): for x in range(100, 1001, 100): buble_position = sd.get_point(x, y) draw_buble(position=buble_position, radius=30, color=sd.COLOR_WHITE) time.sleep(1) sd.clear_screen() # # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами for _ in range(100): buble_position = sd.random_point() step = random.randint(3, 10) time.sleep(0.1) draw_buble(position=buble_position, radius=50, step=step, color=sd.random_color(), width=1) sd.pause() # Зачет!
from epic_painting.wood import draw_random_branches from epic_painting.sun import draw_animate_sun FLAKES_NUMBER = 50 # Количество снежинок SUN_RADIUS_MAX = 50 # Радиус солнышка sd.resolution = (1000, 400) # Рисуем деревья for _ in range(3): root_point = sd.get_point(sd.random_number(795, 900), sd.random_number(15, 20)) draw_random_branches(start_point=root_point, angle=sd.random_number(80, 100), length=sd.random_number(25, 55)) sd.random_point() # Травка sd.rectangle(sd.get_point(0, 0), sd.get_point(sd.resolution[0], 20), sd.COLOR_DARK_GREEN) # Человечек draw_smile(450, 150, sd.COLOR_YELLOW) sd.line(sd.get_point(450, 100), sd.get_point(450, 50)) sd.line(sd.get_point(450, 50), sd.get_point(420, 20)) # Ноги sd.line(sd.get_point(450, 50), sd.get_point(480, 20)) sd.line(sd.get_point(450, 80), sd.get_point(420, 90)) # Руки sd.line(sd.get_point(450, 80), sd.get_point(480, 90)) # Строим стену, крышу, окно sd.rectangle(sd.get_point(600, 20), sd.get_point(770, 110), color=sd.COLOR_RED)
def __init__(self): point = sd.random_point() self.base_point = point self.next_point = point self.angle = 0
v4.draw() v5 = sd.get_vector(start_point=v4.end_point, angle=_angle + 240, length=_length, width=3) v5.draw() v6 = sd.get_vector(start_point=v5.end_point, angle=_angle + 300, length=_length, width=3) v6.draw() triangle(_point=sd.random_point(), _angle=23, _length=100) square(_point=sd.random_point(), _angle=67, _length=100) pentagon(_point=sd.random_point(), _angle=35, _length=100) hexagon(_point=sd.random_point(), _angle=8, _length=100) # Часть 1-бис. # Попробуйте прикинуть обьем работы, если нужно будет внести изменения в этот код. # Скажем, связывать точки не линиями, а дугами. Или двойными линиями. Или рисовать круги в угловых точках. Или... # А если таких функций не 4, а 44? Код писать не нужно, просто представь объем работы... и запомни это. # Часть 2 (делается после зачета первой части) # # Надо сформировать функцию, параметризированную в местах где была "небольшая правка". # Это называется "Выделить общую часть алгоритма в отдельную функцию" # Потом надо изменить функции рисования конкретных фигур - вызывать общую функцию вместо "почти" одинакового кода. #
# Написать функцию рисования пузырька, принммающую 2 (или более) параметра: точка рисовании и шаг def paint_circle(x, y, radius_step): center_circle_2 = sd.get_point(x, y) radius_2 = 50 for _ in range(3): radius_2 += radius_step sd.circle(center_circle_2, radius_2) paint_circle(500, 500, 10) # Нарисовать 10 пузырьков в ряд for i in range(10): step = 100 * i paint_circle(step, 400, 10) # Нарисовать три ряда по 10 пузырьков for j in range(3): step_y = 100 * j for i in range(10): step = 100 * i paint_circle(step, step_y, 10) # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами for _ in range(101): sd.circle(sd.random_point(), 30) sd.pause()
def random_smiles(quantity): for _ in range(quantity): point = sd.random_point() smile(point.x, point.y)
# point = sd.get_point(z,y) # sd.circle(point, rad) # Нарисовать три ряда по 10 пузырьков # TODO здесь ваш код # rad = 30 # x, y = 35, 35 # for j in range(3): # z = -35 # for i in range(10): # z += 2 * x # point = sd.get_point(z,y) # sd.circle(point, rad) # y += rad * 4 # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами # TODO здесь ваш код for _ in range(100): radiusCircle = sd.random_number() pointCircle = sd.random_point() colorCircle = sd.random_color() sd.circle(pointCircle, radiusCircle, color=colorCircle) sd.pause()
body_point1 = simple_draw.get_point(point.x, point.y - radius) body = simple_draw.get_vector(start_point=body_point1, angle=270, length=radius * 2) body.draw() #legs simple_draw.get_vector(start_point=body.end_point, angle=240, length=radius * 1.7).draw() simple_draw.get_vector(start_point=body.end_point, angle=300, length=radius * 1.7).draw() #arms arm_point = simple_draw.get_point(point.x, point.y - radius * 1.7) simple_draw.get_vector(start_point=arm_point, angle=140, length=radius * 1.6).draw() simple_draw.get_vector(start_point=arm_point, angle=40, length=radius * 1.6).draw() for _ in range(10): point = simple_draw.random_point() smailik(point=point, radius=30) # simple_draw.random_point().x +150 # point = simple_draw.random_point() # print(simple_draw.get_point(point.x, point.y)) simple_draw.pause()
# TODO: понимаю зачем раньше добавляли _fun. Избавлялись от warning`а "shadow names". _radius = 30 # если переменная не используется (как "num_of_circle_fun"), то ее можно заменить на "_", это подчеркивает # что данная переменная не важна. for _radius in range(_radius, _radius + 3 * radius_step, radius_step): # сможете сделать так, чтобы цикл # выдавал значения радиуса? sd.circle(center_point, _radius, color, 1) draw_bubble(sd.get_point(500, 500), 7, sd.COLOR_CYAN) # Нарисовать 10 пузырьков в ряд for bubble_coord_x in range(100, 1001, 100): draw_bubble(sd.get_point(bubble_coord_x, 100), 4) # Нарисовать три ряда по 10 пузырьков for bubble_coord_y in range(100, 301, 100): for bubble_coord_x in range(100, 1001, 100): draw_bubble(sd.get_point(bubble_coord_x, bubble_coord_y), 4, color=sd.COLOR_DARK_ORANGE) # пожалуйста дайте им какой-нибудь цвет, чтобы я убедился, # что дефолтное значение color - это не просто лазейка)) # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами for _ in range(100): # для генерации рандоного цвета используйте sd.random_color() # подставлять "голую" цифры 4 - не очень стиль. Лучше добавить: bubble(..., radius_step=4, ...) draw_bubble(sd.random_point(), radius_step=4, color=sd.random_color()) sd.pause() # зачет!
width=5) point_left_eye = sd.get_point(point_center.x - offset_eye[0], point_center.y + offset_eye[1]) sd.circle(center_position=point_left_eye, radius=5, color=color) point_right_eye = sd.get_point(point_center.x + offset_eye[0], point_center.y + offset_eye[1]) sd.circle(center_position=point_right_eye, radius=5, color=color) point1 = sd.get_point(point_center.x - offset_lips[0], point_center.y) point2 = sd.get_point(point_center.x - offset_lips[1], point_center.y - offset_lips[1]) point3 = sd.get_point(point_center.x + offset_lips[1], point_center.y - offset_lips[1]) point4 = sd.get_point(point_center.x + offset_lips[0], point_center.y) smile_point_list = [point1, point2, point3, point4] sd.lines(point_list=smile_point_list, color=color, closed=False, width=3) for _ in range(10): smile_param = sd.random_point() smile(smile_param.x, smile_param.y, sd.COLOR_RED) sd.pause() # зачёт! 🚀 # Написать функцию отрисовки смайлика по заданным координатам # Форма рожицы-смайлика на ваше усмотрение # Параметры функции: кордината X, координата Y, цвет. # Вывести 10 смайликов в произвольных точках экрана.
break sd.snowflake(point, lengths, sd.background_color, factor_c=angle) point.y -= step for i in range(N): snowfall_lengths_tuple.append(random.randint(10, 100)) for i in range(N): snowfall_snowflake_color.append(sd.random_color()) for i in range(N): snowfall_snowflake_angle.append(random.randint(10, 90)) for i in range(N): snowfall_points_tuple.append(sd.random_point()) for i in range(N): snowfall_print(snowfall_points_tuple[i], snowfall_lengths_tuple[i], snowfall_step_snowfall, snowfall_snowflake_color[i], snowfall_snowflake_angle[i]) sd.pause() # подсказка! для ускорения отрисовки можно # - убрать clear_screen() # - в начале рисования всех снежинок вызвать sd.start_drawing() # - на старом месте снежинки отрисовать её же, но цветом sd.background_color # - сдвинуть снежинку # - отрисовать её цветом sd.COLOR_WHITE на новом месте # - после отрисовки всех снежинок, перед sleep(), вызвать sd.finish_drawing()
'4': sd.COLOR_GREEN, '5': sd.COLOR_CYAN, '6': sd.COLOR_BLUE, '7': sd.COLOR_PURPLE } while True: color = input('1 - Red\n' '2 - Orange\n' '3 - Yellow\n' '4 - Green\n' '5 - Cyan\n' '6 - Blue\n' '7 - Purple\n' 'Выберите номер цвета: ') if color in palette: point_0 = sd.random_point() point_1 = sd.random_point() point_2 = sd.random_point() point_3 = sd.random_point() vector_triangle(point_0, 90, 100, palette[color]) vector_square(point_1, 90, 100, palette[color]) vector_pentagon(point_2, 90, 100, palette[color]) vector_hexagon(point_3, 90, 100, palette[color]) break else: print('Неверный ввод!') sd.pause()
import simple_draw as sd sd.resolution = (1200, 600) def bubble_paint(x, y, step): point = sd.get_point(x, y) radius = 50 for _ in range(3): sd.circle(center_position=point, radius=radius, width=2) radius += step # Нарисовать три ряда по 10 пузырьков for y in range(100, 400, 100): for x in range(100, 1000, 90): bubble_paint(x, y, 5) # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами for _ in range(100): sd.circle(sd.random_point(), 50, sd.random_color()) sd.pause()
# Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами """ хотел здесь после пятисекундной паузы почистить экран, но кажется, что констукция sd.start_drawing() ... sd.finish_drawing() sd.sleep(5) sd.start_drawing() ... sd.finish_drawing() работает некорректно. Вместо того, чтобы вывести буфер и приостановить вывод на 5 секунд, окно просто на эти 5 секунд подвисает без какого-либо вывода """ # Именно так и должна работать sd.sleep(5)! А пара функций start/finish_drawing ускоряет вывод графики, но ни на # очистку, ни на паузу никак не влияет. Паузы и очистку вставил сам при проверке. # TODO Это я всё понял. Значит всё таки косяк из-за работы под макосью for _ in range(100): bubble_center = sd.random_point() color = sd.random_color() bubble_radius = randint(10, 100) draw_bubble(bubble_center, bubble_radius, line_width=1, step=3, color=color) sd.pause() # зачет! На вопрос ответил выше
def get_snowflake_point(count): while count > 0: snowflake_points.append(sd.random_point()) count -= 1 return snowflake_points
sd.circle(center_position = point, radius = 100) sd.circle(center_position = point, radius = 95) sd.circle(center_position = point, radius = 90) # Написать функцию рисования пузырька, принимающую 2 (или более) параметра: точка рисовании и шаг def bubble(point = (100, 100), step = 50): sd.circle(center_position=sd.get_point(point[0], point[1]), radius=step) bubble((100, 100), 10) # Нарисовать 10 пузырьков в ряд for i in range(10): bubble((40*(1+i), 200), 20) # Нарисовать три ряда по 10 пузырьков for i in range(3): for j in range(10): bubble((100*(1+j), 100*(1+i)), 50) # Нарисовать 100 пузырьков в произвольных местах экрана случайными цветами # for i in range(100): sd.circle(sd.random_point(), radius=sd.random_number(20, 100), color=sd.random_color()) sd.pause() # зачет!
y=y_bottom + sd.random_number(20, 30)) point4 = sd.get_point(x=x_right - sd.random_number(40, 50), y=y_bottom + sd.random_number(15, 25)) point5 = sd.get_point(x=x_right - sd.random_number(20, 40), y=y_bottom + sd.random_number(30, 45)) points = [point1, point2, point3, point4, point5] random_points_list1 = points[0:sd.random_number(2, 5)] random_points_list2 = points[sd.random_number(0, 3):5] random_points_list3 = points[::2] random_points_list4 = points[1::2] random_points_list = sd.choice([ random_points_list1, random_points_list2, random_points_list3, random_points_list4 ]) closed = sd.choice([True, False]) sd.lines(point_list=random_points_list, color=color, closed=closed, width=sd.random_number(1, 4)) # smile(X=sd.random_number(70,1140), Y=sd.random_number(50,550), color=None) dict_used_points = dict() for _ in range(25): smile(point=sd.random_point(), color=None) # print(dict_used_points) sd.pause()
# -*- coding: utf-8 -*- import random import simple_draw as sd sd.resolution = (1200, 600) def bubble(point, step, color): radius = 100 color = color for _ in range(3): radius += step sd.circle(center_position=point, radius=radius, color=color, width=2) for _ in range(100): point1 = sd.random_point() step1 = random.randint(2, 10) color1 = sd.random_color() bubble(point=point1, step=step1, color=color1) sd.pause() #зачет!
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> import simple_draw as sd def smile_draw(x, y, color): radius = 80 sd.circle(center_position=sd.get_point(x, y), color=color, radius=radius, width=2) for step in (-25, 25): eye = sd.get_point(x + step, y + 15) sd.circle(center_position=eye, color=color, radius=5, width=2) for i in range(45, 140): start_point = sd.get_point(x - 90 + i, y + 50 - 100 * sd.sin(i)) end_point = sd.get_point(x - 90 + i, y + 50 - 100 * sd.sin(i)) sd.line(start_point=start_point, end_point=end_point, color=color, width=2) for _ in range(10): smile_draw(x=sd.random_point().x, y=sd.random_point().y, color=sd.random_color()) sd.pause()
def smile(point, color): # голова смайла x = point.x y = point.y if x < 90: x = 90 elif point.x > 1110: x = 1110 if y < 80: y = 80 elif y > 520: y = 520 # point = sd.get_point(x, y) random_delta_x = sd.random_number(50, 90) random_delta_y = sd.random_number(40, random_delta_x - 10) x_left = x - random_delta_x if x_left < 0: x_left = 0 x_right = x + random_delta_x if x_right > 1200: x_right = 1200 y_top = y + random_delta_y if y_top > 600: y_top = 600 y_bottom = y - random_delta_y if y_bottom < 0: y_bottom = 0 left_bottom = sd.get_point(x=x_left, y=y_bottom) right_top = sd.get_point(x=x_right, y=y_top) color = sd.random_color() # отрисовка с условием чтоб смайлы не накладывались друг на друга if not dict_used_points: dict_used_points.setdefault((0, 0), (0, 0)) for key, value in dict_used_points.items(): if0 = (key[0] < left_bottom.x < value[0]) & (key[1] < left_bottom.y < value[1]) if1 = (left_bottom.x >= value[0]) or (left_bottom.y >= value[1]) if2 = (right_top.x <= key[0]) or (right_top.y <= key[1]) if if0 or all([not if1, not if2]): return smile(point=sd.random_point(), color=None) sd.ellipse(left_bottom, right_top, color=color, width=2) dict_used_points.setdefault((left_bottom.x, left_bottom.y), (right_top.x, right_top.y)) # глаза center_left_eye = sd.get_point(x=x_left + sd.random_number(30, 40), y=y_top - sd.random_number(30, 35)) radius_left_eye = sd.random_number(7, 10) # width_left_eye = sd.random_number(2, 4) * sd.random_number(0, 1) center_right_eye = sd.get_point(x=x_right - sd.random_number(30, 40), y=y_top - sd.random_number(30, 35)) radius_right_eye = sd.random_number(7, 10) # widht_right_eye = sd.random_number(2, 4) * sd.random_number(0, 1) sd.circle(center_position=center_left_eye, radius=radius_left_eye, color=color, width=sd.random_number(0, 2)) sd.circle(center_position=center_right_eye, radius=radius_right_eye, color=color, width=sd.random_number(0, 2)) # рот point1 = sd.get_point(x=x_left + sd.random_number(20, 40), y=y_bottom + sd.random_number(30, 40)) point2 = sd.get_point(x=x_left + sd.random_number(40, 50), y=y - random_delta_y + sd.random_number(15, 25)) point3 = sd.get_point(x=x + sd.random_number(-10, 10), y=y_bottom + sd.random_number(20, 30)) point4 = sd.get_point(x=x_right - sd.random_number(40, 50), y=y_bottom + sd.random_number(15, 25)) point5 = sd.get_point(x=x_right - sd.random_number(20, 40), y=y_bottom + sd.random_number(30, 45)) points = [point1, point2, point3, point4, point5] random_points_list1 = points[0:sd.random_number(2, 5)] random_points_list2 = points[sd.random_number(0, 3):5] random_points_list3 = points[::2] random_points_list4 = points[1::2] random_points_list = sd.choice([ random_points_list1, random_points_list2, random_points_list3, random_points_list4 ]) closed = sd.choice([True, False]) sd.lines(point_list=random_points_list, color=color, closed=closed, width=sd.random_number(1, 4))
# -*- coding: utf-8 -*- # (определение функций) import simple_draw as sd # Написать функцию отрисовки смайлика в произвольной точке экрана # Форма рожицы-смайлика на ваше усмотрение # Параметры функции: кордината X, координата Y, цвет. # Вывести 10 смайликов в произвольных точках экрана. def smile(point, color): sd.circle(center_position=point, color=color, radius=50, width=1) def lines(): sd.lines(point_list=(sd.get_point(1, 20), sd.get_point(20, 10), sd.get_point(40, 10), sd.get_point(60, 20)), color=sd.COLOR_GREEN) for _ in range(10): point = sd.random_point() color = sd.COLOR_GREEN smile(point=point, color=color) lines() sd.pause()
def random_bubbles(quantity): for _ in range(quantity): point = sd.random_point() colors = sd.random_color() bubble(point, 10, color=colors)