Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on lab 1 #7

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Scratch work/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var_ls = !ls -l
type(var_ls)
52 changes: 52 additions & 0 deletions Scratch work/drawing_samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This is a single-line comment.
import arcade
# Задать константы для размеров экрана
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600

# Открыть окно. Задать заголовок и размеры окна (ширина и высота)
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing Example")

# Задать белый цвет фона.
# Для просмотра списка названий цветов прочитайте:
# http://arcade.academy/arcade.color.html
# Цвета также можно задавать в (красный, зеленый, синий) и
# (красный, зеленый, синий, альфа) формате.
arcade.set_background_color(arcade.color.WHITE)

# Начать процесс рендера. Это нужно сделать до команд рисования
arcade.start_render()

# Нарисовать лицо
x = 300
y = 300
radius = 200
arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW)

# Нарисовать правый глаз
x = 370
y = 350
radius = 20
arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)

# Нарисовать левый глаз
x = 230
y = 350
radius = 20
arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)

# Нарисовать улыбку
x = 300
y = 280
width = 120
height = 100
start_angle = 190
end_angle = 350
arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle,
end_angle, 10)

# Завершить рисование и показать результат
arcade.finish_render()

# Держать окно открытым до тех пор, пока пользователь не нажмет кнопку “закрыть”
arcade.run()
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Используйте IntelliSense, чтобы узнать о возможных атрибутах.
// Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов.
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: текущий файл",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
Binary file added Lab 01 - First Program/.1.py.swp
Binary file not shown.
8 changes: 8 additions & 0 deletions Lab 01 - First Program/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
print ("fdghhh")
print("vvedit parol")
pas = input("vvedit pas")
if pas == "secret":
print("dostup vidkruto")
input("press enter")


50 changes: 50 additions & 0 deletions Lab 01 - First Program/lab_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This is a single-line comment.
import arcade
# Задать константы для размеров экрана
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600

# Открыть окно. Задать заголовок и размеры окна (ширина и высота)
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing Example")

# Задать белый цвет фона.
# Цвета также можно задавать в (красный, зеленый, синий) и
# (красный, зеленый, синий, альфа) формате.
arcade.set_background_color(arcade.color.WHITE)

# Начать процесс рендера. Это нужно сделать до команд рисования
arcade.start_render()

# Нарисовать лицо
x = 300
y = 300
radius = 200
arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW)

# Нарисовать правый глаз
x = 370
y = 350
radius = 20
arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)

# Нарисовать левый глаз
x = 230
y = 350
radius = 20
arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)

# Нарисовать улыбку
x = 300
y = 280
width = 120
height = 100
start_angle = 190
end_angle = 350
arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle,
end_angle, 10)

# Завершить рисование и показать результат
arcade.finish_render()

# Держать окно открытым до тех пор, пока пользователь не нажмет кнопку “закрыть”
arcade.run()
86 changes: 86 additions & 0 deletions Lab 02 - Draw a Picture/lab_02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"""
This is a sample program to show how to draw using the Python programming
language and the Arcade library.
"""

# Import the "arcade" library
import arcade

# Open up a window.
# From the "arcade" library, use a function called "open_window"
# Set the window title to "Drawing Example"
# Set the and dimensions (width and height)
arcade.open_window(800, 600, "Drawing Example")

# Set the background color
arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE)

# Get ready to draw
arcade.start_render()

# Draw the grass
arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BITTER_LIME)

# Barn cement base
arcade.draw_lrtb_rectangle_filled(30, 350, 210, 170, arcade.color.BISQUE)

# draw the wall
arcade.draw_lrtb_rectangle_filled(30, 350, 400, 190, arcade.color.BROWN)


arcade.draw_polygon_filled([[10, 400],
[75, 540],
[300, 540],
[380, 400]],
arcade.color.BROWN)
'''# Draw the top
arcade.draw_triangle_filled(15, 400, 65, 400, 65, 500, arcade.color.BROWN)
arcade.draw_triangle_filled(300, 400, 365, 400, 300, 500, arcade.color.BROWN)
arcade.draw_lrtb_rectangle_filled(65, 300, 500, 400, arcade.color.LAVA)

arcade.draw_triangle_filled(65, 500, 300, 500, 180, 550, arcade.color.BROWN)
'''
#window top
arcade.draw_lrtb_rectangle_filled(65, 125, 480, 415, arcade.color.BLACK)
arcade.draw_lrtb_rectangle_filled(230, 300, 480, 420, arcade.color.BLACK)
arcade.draw_lrtb_rectangle_filled(70, 120, 475, 420, arcade.color.WHITE)
arcade.draw_lrtb_rectangle_filled(235, 295, 475, 425, arcade.color.WHITE)

#window left
arcade.draw_lrtb_rectangle_filled(65, 125, 300, 250, arcade.color.BLACK )
arcade.draw_lrtb_rectangle_filled(70, 120, 295, 255, arcade.color.WHITE )

#window right
arcade.draw_lrtb_rectangle_filled(230, 300, 300, 250, arcade.color.BLACK )
arcade.draw_lrtb_rectangle_filled(235, 295, 295, 255, arcade.color.WHITE )

#door
arcade.draw_lrtb_rectangle_filled(150, 200, 300, 190, arcade.color.ASH_GREY )


#machine body
arcade.draw_lrtb_rectangle_filled(480, 690, 210, 120, arcade.color.ASH_GREY )
arcade.draw_lrtb_rectangle_filled(510, 650, 150, 120, arcade.color.BLACK )
arcade.draw_lrtb_rectangle_filled(600, 610, 250, 210, arcade.color.BLACK )

#back wheel
arcade.draw_circle_filled(450, 150, 55, arcade.color.BLACK)
arcade.draw_circle_filled(450, 150, 50, arcade.color.PAYNE_GREY)
arcade.draw_circle_filled(450, 150, 35, arcade.color.WHITE)
arcade.draw_circle_filled(450, 150, 15, arcade.color.RED)

#front wheel
arcade.draw_circle_filled(650, 130, 35, arcade.color.BLACK)
arcade.draw_circle_filled(650, 130, 30, arcade.color.PAYNE_GREY)
arcade.draw_circle_filled(650, 130, 25, arcade.color.WHITE)
arcade.draw_circle_filled(650, 130, 5, arcade.color.RED)





# --- Finish drawing ---
arcade.finish_render()

# Keep the window up until someone closes it.
arcade.run()
51 changes: 51 additions & 0 deletions Lab 03 - Draw Using Functions/Snow_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import arcade

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

def draw_grass():
""" Draw the ground """
arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3, 0, arcade.color.GREEN)

def draw_snow_person(x, y):
""" Draw a snow person """

# Draw a point at x, y for reference
arcade.draw_point(x, y, arcade.color.RED, 5)

# Snow
arcade.draw_circle_filled(300 + x, 200 + y, 60, arcade.color.WHITE)
arcade.draw_circle_filled(300 + x, 280 + y, 50, arcade.color.WHITE)
arcade.draw_circle_filled(300 + x, 340 + y, 40, arcade.color.WHITE)

# Eyes
arcade.draw_circle_filled(285 + x, 350 + y, 5, arcade.color.BLACK)
arcade.draw_circle_filled(315 + x, 350 + y, 5, arcade.color.BLACK)

def on_draw(delta_time):
""" Draw everything """
arcade.start_render()

draw_grass()
draw_snow_person(on_draw.snow_person1_x, 140)
draw_snow_person(450, 180)
on_draw.snow_person1_x = 150

def main():
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing with Functions")
arcade.set_background_color(arcade.color.DARK_BLUE)
arcade.start_render()

arcade.schedule(on_draw, 1/60)
arcade.run()

# Finish and run
arcade.finish_render()
arcade.run()






main()
41 changes: 41 additions & 0 deletions Lab 03 - Draw Using Functions/lab_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Import the "arcade" library
import arcade

# Open up a window.
# From the "arcade" library, use a function called "open_window"
# Set the window title to "Drawing Example"
# Set the and dimensions (width and height)
arcade.open_window(800, 600, "Drawing Example")

# Set the background color
arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE)

# Get ready to draw
arcade.start_render()


arcade.draw_ellipse_outline(450, 50, 470, 700, arcade.csscolor.DIM_GREY, 3)
arcade.draw_ellipse_filled(450, 50, 465, 695, arcade.csscolor.DARK_GREEN)
arcade.draw_ellipse_outline(800, 300, 700, 400, arcade.csscolor.DIM_GREY, 3)
arcade.draw_ellipse_filled(800, 300, 695, 395, arcade.csscolor.DARK_GREEN)
arcade.draw_ellipse_outline(250, 200, 600, 270, arcade.csscolor.DIM_GREY, 3)
arcade.draw_ellipse_filled(250, 200, 595, 265, arcade.csscolor.DARK_GREEN)
arcade.draw_ellipse_outline(1, 250, 700, 400, arcade.csscolor.DIM_GREY, 3)
arcade.draw_ellipse_filled(1, 250, 695, 395, arcade.csscolor.DARK_GREEN)

arcade.draw_lrtb_rectangle_filled(0, 800, 180, 0, arcade.color.MINT_GREEN)

arcade.draw_arc_outline(300,
340,
70,
50,
arcade.csscolor.BLACK,
20,
180,
3,
0)
# --- Finish drawing ---
arcade.finish_render()

# Keep the window up until someone closes it.
arcade.run()
20 changes: 20 additions & 0 deletions Lab 04 - Camel/1-9_romb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
for row in range(10):

for space in range( 10 - row ):
print(" ", end=" ")
for column in range(1, row + 1):
print(column, end=" ")
for column in range( row - 1, 0, -1 ):
print(column, end=" ")
print()
for row2 in range (10):

for space2 in range(row2 + 2):
print(" ", end=" ")
for column2 in range(1, 9 - row2 ):
print(column2, end=" ")
for column2 in range(7 - row2, 0, -1):
print(column2, end=" ")


print()
11 changes: 11 additions & 0 deletions Lab 04 - Camel/12month.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
months = "JanFebMarAprMayJunJulAugSepOctNovDec"
n = int(input("Enter a month number: "))
k = 1
s = 0
e = 3
while k != n:
k += 1
s += 3
e += 3

print(months[s:e])
4 changes: 4 additions & 0 deletions Lab 04 - Camel/12month_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
months = "JanFebMarAprMayJunJulAugSepOctNovDec"
n = int(input("Enter a month number: "))
selected_month = [months[i:i+3] for i in range(0, len(months), 3)][n-1]
print('selected month is: ', selected_month)
Loading