{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "209bc3e2",
   "metadata": {},
   "source": [
    "# 07-11 · Перо и заливка\n",
    "\n",
    "Практика к разделу [«Перо и заливка — не одно и то же»](../../site/chapters/glava-07/07-11-pero-i-zalivka.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4252d990",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Различать pencolor(), fillcolor() и color()."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "59f9d376",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "bb65bf3c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:36.799518Z",
     "iopub.status.busy": "2026-08-16T15:16:36.799321Z",
     "iopub.status.idle": "2026-08-16T15:16:36.992793Z",
     "shell.execute_reply": "2026-08-16T15:16:36.992076Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.pensize(3)\n",
    "artist.pencolor(\"#5B24F9\")\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "33ee699c",
   "metadata": {},
   "source": [
    "## Рабочий пример\n",
    "\n",
    "color() задаёт оба цвета разом."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "730edf5f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:36.994501Z",
     "iopub.status.busy": "2026-08-16T15:16:36.994356Z",
     "iopub.status.idle": "2026-08-16T15:16:37.927845Z",
     "shell.execute_reply": "2026-08-16T15:16:37.927263Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.color(\"blue\", \"gold\")\n",
    "artist.begin_fill()\n",
    "for _ in range(4):\n",
    "    artist.forward(100)\n",
    "    artist.right(90)\n",
    "artist.end_fill()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6ec34eac",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Нарисуйте треугольник с синим контуром (pencolor) и зелёной заливкой (fillcolor), заданными раздельно."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "96ba48a0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:37.929237Z",
     "iopub.status.busy": "2026-08-16T15:16:37.929050Z",
     "iopub.status.idle": "2026-08-16T15:16:38.749552Z",
     "shell.execute_reply": "2026-08-16T15:16:38.748881Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.pencolor(\"blue\")\n",
    "artist.fillcolor(\"green\")\n",
    "artist.begin_fill()\n",
    "for _ in range(3):\n",
    "    artist.forward(100)\n",
    "    artist.right(120)\n",
    "artist.end_fill()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6f0821a0",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7b20719b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:38.752195Z",
     "iopub.status.busy": "2026-08-16T15:16:38.751536Z",
     "iopub.status.idle": "2026-08-16T15:16:38.758067Z",
     "shell.execute_reply": "2026-08-16T15:16:38.757428Z"
    }
   },
   "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
}
