コード例 #1
0
def TY_Flowers1(position):
    TY_Flower1 = gr.Circle(gr.Point(80 + position, 300), 15)
    TY_Flower1.setFill('Red')
    TY_Flower1.draw(window)

    TY_Flower2 = gr.Circle(gr.Point(160 + position, 280), 15)
    TY_Flower2.setFill('Red')
    TY_Flower2.draw(window)

    TY_Flower3 = gr.Circle(gr.Point(240 + position, 320), 15)
    TY_Flower3.setFill('Red')
    TY_Flower3.draw(window)

    TY_Flower3 = gr.Circle(gr.Point(210 + position, 240), 15)
    TY_Flower3.setFill('Red')
    TY_Flower3.draw(window)
コード例 #2
0
def TY_Flowers():
    """Paint 4 red flowers"""
    TY_Flower1 = gr.Circle(gr.Point(80, 300), 15)
    TY_Flower1.setFill('Red')
    TY_Flower1.draw(window)

    TY_Flower2 = gr.Circle(gr.Point(160, 280), 15)
    TY_Flower2.setFill('Red')
    TY_Flower2.draw(window)

    TY_Flower3 = gr.Circle(gr.Point(240, 320), 15)
    TY_Flower3.setFill('Red')
    TY_Flower3.draw(window)

    TY_Flower3 = gr.Circle(gr.Point(210, 240), 15)
    TY_Flower3.setFill('Red')
    TY_Flower3.draw(window)
コード例 #3
0
def TY_Cloud(x, y):
    TY_Cloud_1 = gr.Circle(gr.Point(x, y), 15)
    TY_Cloud_1.setFill('Blue')
    TY_Cloud_1.draw(window)

    TY_Cloud_2 = gr.Circle(gr.Point(x + 20, y), 15)
    TY_Cloud_2.setFill('Blue')
    TY_Cloud_2.draw(window)

    TY_Cloud_3 = gr.Circle(gr.Point(x + 40, y), 15)
    TY_Cloud_3.setFill('Blue')
    TY_Cloud_3.draw(window)

    TY_Cloud_4 = gr.Circle(gr.Point(x + 10, y + 15), 15)
    TY_Cloud_4.setFill('Blue')
    TY_Cloud_4.draw(window)

    TY_Cloud_5 = gr.Circle(gr.Point(x + 30, y + 15), 15)
    TY_Cloud_5.setFill('Blue')
    TY_Cloud_5.draw(window)
コード例 #4
0
def TY_Cloud3():
    """Paint Cloud 3"""
    TY_Cloud_1 = gr.Circle(gr.Point(400, 100), 15)
    TY_Cloud_1.setFill('Blue')
    TY_Cloud_1.draw(window)

    TY_Cloud_2 = gr.Circle(gr.Point(420, 100), 15)
    TY_Cloud_2.setFill('Blue')
    TY_Cloud_2.draw(window)

    TY_Cloud_3 = gr.Circle(gr.Point(440, 100), 15)
    TY_Cloud_3.setFill('Blue')
    TY_Cloud_3.draw(window)

    TY_Cloud_4 = gr.Circle(gr.Point(410, 115), 15)
    TY_Cloud_4.setFill('Blue')
    TY_Cloud_4.draw(window)

    TY_Cloud_5 = gr.Circle(gr.Point(430, 115), 15)
    TY_Cloud_5.setFill('Blue')
    TY_Cloud_5.draw(window)
コード例 #5
0
def TY_Cloud2():
    """Paint Cloud 2"""
    TY_Cloud_1 = gr.Circle(gr.Point(250, 60), 15)
    TY_Cloud_1.setFill('Blue')
    TY_Cloud_1.draw(window)

    TY_Cloud_2 = gr.Circle(gr.Point(270, 60), 15)
    TY_Cloud_2.setFill('Blue')
    TY_Cloud_2.draw(window)

    TY_Cloud_3 = gr.Circle(gr.Point(290, 60), 15)
    TY_Cloud_3.setFill('Blue')
    TY_Cloud_3.draw(window)

    TY_Cloud_4 = gr.Circle(gr.Point(260, 75), 15)
    TY_Cloud_4.setFill('Blue')
    TY_Cloud_4.draw(window)

    TY_Cloud_5 = gr.Circle(gr.Point(280, 75), 15)
    TY_Cloud_5.setFill('Blue')
    TY_Cloud_5.draw(window)
コード例 #6
0
def TY_Cloud1():
    """Paint Cloud 1"""
    TY_Cloud_1 = gr.Circle(gr.Point(100, 20), 15)
    TY_Cloud_1.setFill('Blue')
    TY_Cloud_1.draw(window)

    TY_Cloud_2 = gr.Circle(gr.Point(120, 20), 15)
    TY_Cloud_2.setFill('Blue')
    TY_Cloud_2.draw(window)

    TY_Cloud_3 = gr.Circle(gr.Point(140, 20), 15)
    TY_Cloud_3.setFill('Blue')
    TY_Cloud_3.draw(window)

    TY_Cloud_4 = gr.Circle(gr.Point(110, 35), 15)
    TY_Cloud_4.setFill('Blue')
    TY_Cloud_4.draw(window)

    TY_Cloud_5 = gr.Circle(gr.Point(130, 35), 15)
    TY_Cloud_5.setFill('Blue')
    TY_Cloud_5.draw(window)
コード例 #7
0
def TY_Sun1():
    TY_Sun_Circle = gr.Circle(gr.Point(500, 0), 50)
    TY_Sun_Circle.setFill('Yellow')
    TY_Sun_Circle.draw(window)

    TY_Sun_Ray1 = gr.Line(gr.Point(500, 0), gr.Point(420, 120))
    TY_Sun_Ray1.setFill('Yellow')
    TY_Sun_Ray1.draw(window)

    TY_Sun_Ray2 = gr.Line(gr.Point(500, 0), gr.Point(350, 90))
    TY_Sun_Ray2.setFill('Yellow')
    TY_Sun_Ray2.draw(window)

    TY_Sun_Ray3 = gr.Line(gr.Point(500, 0), gr.Point(280, 50))
    TY_Sun_Ray3.setFill('Yellow')
    TY_Sun_Ray3.draw(window)

    TY_Sun_Ray4 = gr.Line(gr.Point(500, 0), gr.Point(200, 20))
    TY_Sun_Ray4.setFill('Yellow')
    TY_Sun_Ray4.draw(window)
コード例 #8
0
def TY_House():
    """Paint house"""
    TY_House_Roof = gr.Circle(gr.Point(350, 150), 50)
    TY_House_Roof.setFill('Brown')
    TY_House_Roof.draw(window)

    TY_House_Wall = gr.Rectangle(gr.Point(300, 300), gr.Point(400, 150))
    TY_House_Wall.setFill('Gray')
    TY_House_Wall.draw(window)

    TY_House_Step = gr.Rectangle(gr.Point(320, 300), gr.Point(380, 280))
    TY_House_Step.setFill('Black')
    TY_House_Step.draw(window)

    TY_House_Door = gr.Rectangle(gr.Point(330, 280), gr.Point(370, 220))
    TY_House_Door.setFill('Orange')
    TY_House_Door.draw(window)

    TY_House_Tube = gr.Rectangle(gr.Point(370, 130), gr.Point(390, 90))
    TY_House_Tube.setFill('Black')
    TY_House_Tube.draw(window)
コード例 #9
0
def TY_House1(place):
    TY_House_Roof = gr.Circle(gr.Point(350 + place, 150), 50)
    TY_House_Roof.setFill('Brown')
    TY_House_Roof.draw(window)

    TY_House_Wall = gr.Rectangle(gr.Point(300 + place, 300),
                                 gr.Point(400 + place, 150))
    TY_House_Wall.setFill('Gray')
    TY_House_Wall.draw(window)

    TY_House_Step = gr.Rectangle(gr.Point(320 + place, 300),
                                 gr.Point(380 + place, 280))
    TY_House_Step.setFill('Black')
    TY_House_Step.draw(window)

    TY_House_Door = gr.Rectangle(gr.Point(330 + place, 280),
                                 gr.Point(370 + place, 220))
    TY_House_Door.setFill('Orange')
    TY_House_Door.draw(window)

    TY_House_Tube = gr.Rectangle(gr.Point(370 + place, 130),
                                 gr.Point(390 + place, 90))
    TY_House_Tube.setFill('Black')
    TY_House_Tube.draw(window)
コード例 #10
0
def TY_Tree1(mesto):
    TY_Tree_Wood = gr.Rectangle(gr.Point(50 + mesto, 220),
                                gr.Point(80 + mesto, 170))
    TY_Tree_Wood.setFill('Brown')
    TY_Tree_Wood.draw(window)

    TY_Tree_Leafs = gr.Circle(gr.Point(65 + mesto, 145), 50)
    TY_Tree_Leafs.setFill('Green')
    TY_Tree_Leafs.draw(window)

    TY_Tree_Apple1 = gr.Circle(gr.Point(80 + mesto, 155), 10)
    TY_Tree_Apple1.setFill('Yellow')
    TY_Tree_Apple1.draw(window)

    TY_Tree_Apple2 = gr.Circle(gr.Point(60 + mesto, 115), 10)
    TY_Tree_Apple2.setFill('Yellow')
    TY_Tree_Apple2.draw(window)

    TY_Tree_Apple3 = gr.Circle(gr.Point(90 + mesto, 125), 10)
    TY_Tree_Apple3.setFill('Yellow')
    TY_Tree_Apple3.draw(window)
コード例 #11
0
def TY_Tree():
    """Paint Tree"""
    TY_Tree_Wood = gr.Rectangle(gr.Point(50, 220), gr.Point(80, 170))
    TY_Tree_Wood.setFill('Brown')
    TY_Tree_Wood.draw(window)

    TY_Tree_Leafs = gr.Circle(gr.Point(65, 145), 50)
    TY_Tree_Leafs.setFill('Green')
    TY_Tree_Leafs.draw(window)

    TY_Tree_Apple1 = gr.Circle(gr.Point(80, 155), 10)
    TY_Tree_Apple1.setFill('Yellow')
    TY_Tree_Apple1.draw(window)

    TY_Tree_Apple2 = gr.Circle(gr.Point(60, 115), 10)
    TY_Tree_Apple2.setFill('Yellow')
    TY_Tree_Apple2.draw(window)

    TY_Tree_Apple3 = gr.Circle(gr.Point(90, 125), 10)
    TY_Tree_Apple3.setFill('Yellow')
    TY_Tree_Apple3.draw(window)
コード例 #12
0
"""MIPT Python Course. Contest4"""
from lib import graphics as gr
window = gr.GraphWin("TY_Picture", 500, 350)
print('Задание 1')  # Exercise 1
TY_Field1 = gr.Rectangle(gr.Point(0, 350), gr.Point(500, 200))
TY_Field1.draw(window)
TY_Field1.setFill('Green')

TY_Flower1 = gr.Circle(gr.Point(80, 300), 15)
TY_Flower1.setFill('Red')
TY_Flower1.draw(window)

TY_Flower2 = gr.Circle(gr.Point(160, 280), 15)
TY_Flower2.setFill('Red')
TY_Flower2.draw(window)

TY_Flower3 = gr.Circle(gr.Point(240, 320), 15)
TY_Flower3.setFill('Red')
TY_Flower3.draw(window)

TY_Flower3 = gr.Circle(gr.Point(210, 240), 15)
TY_Flower3.setFill('Red')
TY_Flower3.draw(window)

TY_House_Roof = gr.Circle(gr.Point(350, 150), 50)
TY_House_Roof.setFill('Brown')
TY_House_Roof.draw(window)

TY_House_Wall = gr.Rectangle(gr.Point(300, 300), gr.Point(400, 150))
TY_House_Wall.setFill('Gray')
TY_House_Wall.draw(window)
コード例 #13
0
def clear_window():
    """Функция, очищающая поле"""
    rectangle = gr.Rectangle(gr.Point(0, 0), gr.Point(SIZE_X, SIZE_Y))
    rectangle.setFill('green')
    rectangle.draw(window)
コード例 #14
0
def add(point_1, point_2):
    """Функция, описывающая изменение положения шара"""
    new_point = gr.Point(point_1.x + point_2.x,
                         point_1.y + point_2.y)
    return new_point
コード例 #15
0
"""MIPT Python Course. Contest5"""
from lib import graphics as gr

print('1. Движение шара')
SIZE_X = 400
SIZE_Y = 400
# Исходные данные
window = gr.GraphWin("Model", SIZE_X, SIZE_Y)
coords = gr.Point(200, 200)
velocity = gr.Point(2, 0)


def add(point_1, point_2):
    """Функция, описывающая изменение положения шара"""
    new_point = gr.Point(point_1.x + point_2.x,
                         point_1.y + point_2.y)
    return new_point


def clear_window():
    """Функция, очищающая поле"""
    rectangle = gr.Rectangle(gr.Point(0, 0), gr.Point(SIZE_X, SIZE_Y))
    rectangle.setFill('green')
    rectangle.draw(window)


def wall(coords, velocity):
    """Функция, проверяющая контакт мяча со стеной"""
    if coords.x < 15 or coords.x > SIZE_X - 15:
        velocity.x = -velocity.x
    if coords.y < 15 or coords.y > SIZE_Y - 15: