{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "13f6e62a",
   "metadata": {},
   "source": [
    "# 07-01 · Настраиваем экран и графику\n",
    "\n",
    "Практика к разделам [«Настраиваем экран»](../../site/chapters/glava-07/07-01-nastraivaem-ekran.html) и [«Настраиваем графику»](../../site/chapters/glava-07/07-02-nastraivaem-grafiku.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "db409f4c",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Настроить холст и черепашку: заголовок, фон, скорость, толщину и цвет линии."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c611d482",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6fe981f1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:18.686180Z",
     "iopub.status.busy": "2026-08-14T20:53:18.686070Z",
     "iopub.status.idle": "2026-08-14T20:53:18.860876Z",
     "shell.execute_reply": "2026-08-14T20:53:18.860420Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.speed(0)\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fbe1f6e2",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c32b7289",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:18.862088Z",
     "iopub.status.busy": "2026-08-14T20:53:18.861970Z",
     "iopub.status.idle": "2026-08-14T20:53:18.897128Z",
     "shell.execute_reply": "2026-08-14T20:53:18.896696Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Настройки применены.\n"
     ]
    }
   ],
   "source": [
    "screen.title(\"Моя первая картина\")\n",
    "screen.bgcolor(\"lightblue\")\n",
    "artist.pensize(3)\n",
    "artist.pencolor(\"purple\")\n",
    "artist.forward(100)\n",
    "print(\"Настройки применены.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e87e4fd",
   "metadata": {},
   "source": [
    "## Эксперимент 1\n",
    "\n",
    "Попробуйте свой любимый цвет фона и линии."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "404042e4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:18.898272Z",
     "iopub.status.busy": "2026-08-14T20:53:18.898151Z",
     "iopub.status.idle": "2026-08-14T20:53:19.026826Z",
     "shell.execute_reply": "2026-08-14T20:53:19.026267Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Готово.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "screen.bgcolor(\"black\")\n",
    "artist.pencolor(\"yellow\")\n",
    "artist.forward(100)\n",
    "print(\"Готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "acc15bf5",
   "metadata": {},
   "source": [
    "## Эксперимент 2\n",
    "\n",
    "Измените скорость на 1 (медленно) и на 0 (мгновенно) — сравните разницу, если запускаете локально с настоящим окном."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e6815a21",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:19.028167Z",
     "iopub.status.busy": "2026-08-14T20:53:19.028049Z",
     "iopub.status.idle": "2026-08-14T20:53:19.320424Z",
     "shell.execute_reply": "2026-08-14T20:53:19.320043Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Скорость 1 — медленно.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "artist.speed(1)\n",
    "artist.forward(80)\n",
    "print(\"Скорость 1 — медленно.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85f1224c",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Нарисуйте квадрат толстой (5px) красной линией на жёлтом фоне."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7b8cea0c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:19.321608Z",
     "iopub.status.busy": "2026-08-14T20:53:19.321501Z",
     "iopub.status.idle": "2026-08-14T20:53:20.239371Z",
     "shell.execute_reply": "2026-08-14T20:53:20.238875Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Готово.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "screen.bgcolor(\"yellow\")\n",
    "artist.pensize(5)\n",
    "artist.pencolor(\"red\")\n",
    "for _ in range(4):\n",
    "    artist.forward(100)\n",
    "    artist.right(90)\n",
    "print(\"Готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "62e52540",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "717a2fa5",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:53:20.240361Z",
     "iopub.status.busy": "2026-08-14T20:53:20.240250Z",
     "iopub.status.idle": "2026-08-14T20:53:20.243810Z",
     "shell.execute_reply": "2026-08-14T20:53:20.243402Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle закрыто.\n"
     ]
    }
   ],
   "source": [
    "screen.bye()\n",
    "print(\"Окно Turtle закрыто.\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
