def draw_left_eye(): eye = gr.Circle(gr.Point(150, 180), 20) pupil = gr.Circle(gr.Point(150, 180), 10) eye.setFill('red') pupil.setFill('black') eye.draw(window) pupil.draw(window)
def draw_right_eye(): eye = gr.Circle(gr.Point(250, 180), 14) pupil = gr.Circle(gr.Point(250, 180), 7) eye.setFill('red') pupil.setFill('black') eye.draw(window) pupil.draw(window)
from practise.part4 import graphics as gr window = gr.GraphWin("Jenkslex and Ganzz project", 400, 400) face = gr.Circle(gr.Point(200, 200), 100) face.setFill('yellow') eye1 = gr.Circle(gr.Point(150, 180), 20) eye2 = gr.Circle(gr.Point(250, 180), 15) eye1_center = gr.Circle(gr.Point(150, 180), 8) eye2_center = gr.Circle(gr.Point(250, 180), 7) eye1.setFill('red') eye2.setFill('red') eye1_center.setFill('black') eye2_center.setFill('black') eyebrow1 = gr.Line(gr.Point(100, 120), gr.Point(180, 170)) eyebrow2 = gr.Line(gr.Point(220, 170), gr.Point(300, 140)) eyebrow1.setWidth(10) eyebrow2.setWidth(10) eyebrow1.setOutline('black') eyebrow2.setOutline('black') mouth = gr.Line(gr.Point(150, 260), gr.Point(250, 260)) mouth.setWidth(20) mouth.setOutline('black') face.draw(window) eye1.draw(window) eye2.draw(window) eye1_center.draw(window)
home_window_line6 = gr.Line(gr.Point(350, 350), gr.Point(250, 350)) home_window_line6.setWidth(5) home_window_line6.setOutline('black') home_window_line6.draw(window) points = [gr.Point(200, 200), gr.Point(400, 200), gr.Point(300, 100)] home_roof = gr.Polygon(points) home_roof.setFill('brown') home_roof.draw(window) home_roof_line1 = gr.Line(gr.Point(300, 100), gr.Point(400, 200)) home_roof_line1.setWidth(5) home_roof_line1.setOutline('black') home_roof_line1.draw(window) home_roof_line2 = gr.Line(gr.Point(300, 100), gr.Point(200, 200)) home_roof_line2.setWidth(5) home_roof_line2.setOutline('black') home_roof_line2.draw(window) sun = gr.Circle(gr.Point(750, 100), 60) sun.setFill('yellow') sun.draw(window) # eyebrow1 = gr.Line(gr.Point(100, 120), gr.Point(180, 170)) window.getMouse() window.close()
def draw_face(): face = gr.Circle(gr.Point(200, 200), 100) face.setFill('yellow') face.draw(window)
# подключение библиотеки под синонимом gr from practise.part4 import graphics as gr # Инициализация окна с названием "Russian game" и размером 100х100 пикселей window = gr.GraphWin("Russian game", 100, 100) # Создание круга с радиусом 10 и координатами центра (50, 50) my_circle = gr.Circle(gr.Point(50, 50), 10) # Создание отрезка с концами в точках (2, 4) и (4, 8) my_line = gr.Line(gr.Point(2, 4), gr.Point(4, 8)) # Создание прямоугольника у которого диагональ — отрезок с концами в точках (2, 4) и (4, 8) my_rectangle = gr.Rectangle(gr.Point(2, 4), gr.Point(4, 8)) # Отрисовка примитивов в окне window my_circle.draw(window) my_line.draw(window) my_rectangle.draw(window) # Ожидание нажатия кнопки мыши по окну. window.getMouse() # Закрытие окна после завершения работы с графикой window.close()