From a8e91a29664afc5d4f21e7acb108dce466aee0f3 Mon Sep 17 00:00:00 2001 From: joker Date: Fri, 10 Nov 2023 12:28:48 +0300 Subject: [PATCH] modified: content/posts/informatics/class-10g.mdx --- content/posts/informatics/class-10g.mdx | 45 +++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/content/posts/informatics/class-10g.mdx b/content/posts/informatics/class-10g.mdx index 033c81b..6a6fc19 100644 --- a/content/posts/informatics/class-10g.mdx +++ b/content/posts/informatics/class-10g.mdx @@ -11,9 +11,50 @@ tags: -- [Урок 1](#урок-1) +- [Урок 08.11.23](#урок-1) -## Урок 10.11.23 +## Урок 08.11.23 +~~~python +# Импортируем библиотеку pygame +import pygame +# Импортируем системную функцию exit +from sys import exit + +# Инициализируем pygame +pygame.init() + +k = 6 + +wDisp = 900 +hDisp = 300 + +display = pygame.display.set_mode((wDisp, hDisp)) + +PURPLE = (156, 39, 176) +INDIGO = (63, 81, 181) +BLUE = (33, 150, 243) + +wS = wDisp/3 +hS = hDisp + +pygame.draw.rect(display, PURPLE, ((wDisp/2)-(wS/2)-wS, (hDisp/2)-(hS/2), wS, hS)) +pygame.draw.rect(display, INDIGO, ((wDisp/2)-(wS/2), (hDisp/2)-(hS/2), wS, hS)) +pygame.draw.rect(display, BLUE, ((wDisp/2)-(wS/2)+wS, (hDisp/2)-(hS/2), wS, hS)) + +# Основной цикл игры +while True: + # Ждем события (действия пользователя) + for event in pygame.event.get(): + # Если нажали на крестик, + # то закрываем окно + if event.type == pygame.QUIT: + pygame.quit() + exit() + + # Обновляем поверхность игры + # на каждом шаге основного цикла игры + pygame.display.update() +~~~