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)
def draw_eyebrows(): eyebrow1 = gr.Line(gr.Point(100, 120), gr.Point(180, 170)) eyebrow2 = gr.Line(gr.Point(220, 170), gr.Point(300, 120)) eyebrow1.setWidth(10) eyebrow2.setWidth(10) eyebrow1.setOutline('black') eyebrow2.setOutline('black') eyebrow1.draw(window) eyebrow2.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)
# подключение библиотеки под синонимом gr from practise.part4 import graphics as gr window = gr.GraphWin("task1 - landscape", 1000, 600) sky = gr.Rectangle(gr.Point(0, 0), gr.Point(1000, 300)) sky.setFill('blue') sky.draw(window) home = gr.Rectangle(gr.Point(200, 200), gr.Point(400, 400)) home.setFill('grey') home.draw(window) home_wall1 = gr.Line(gr.Point(200, 200), gr.Point(200, 400)) home_wall1.setWidth(5) home_wall1.setOutline('black') home_wall1.draw(window) home_wall2 = gr.Line(gr.Point(200, 200), gr.Point(400, 200)) home_wall2.setWidth(5) home_wall2.setOutline('black') home_wall2.draw(window) home_wall3 = gr.Line(gr.Point(400, 200), gr.Point(400, 400)) home_wall3.setWidth(5) home_wall3.setOutline('black') home_wall3.draw(window) home_wall4 = gr.Line(gr.Point(400, 400), gr.Point(200, 400)) home_wall4.setWidth(5) home_wall4.setOutline('black')
def draw_mouth(): mouth = gr.Line(gr.Point(150, 260), gr.Point(250, 260)) mouth.setWidth(20) mouth.setOutline('black') mouth.draw(window)
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()