{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c8fcec22",
   "metadata": {},
   "source": [
    "# 07-20 · clear(), reset(), home()\n",
    "\n",
    "Praktyka do sekcji [„clear(), reset() i home()”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7702293f",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Rozróżnić efekt clear(), reset() i home() w praktyce."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e3f68aa3",
   "metadata": {},
   "source": [
    "## Ustawienie (wykonać raz)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "48e15eba",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:55.219466Z",
     "iopub.status.busy": "2026-08-16T15:16:55.219353Z",
     "iopub.status.idle": "2026-08-16T15:16:55.400991Z",
     "shell.execute_reply": "2026-08-16T15:16:55.399355Z"
    }
   },
   "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": "fbe8d18e",
   "metadata": {},
   "source": [
    "## Sprawa robocza\n",
    "\n",
    "reset() usuwa rysunek i oddaje go do domu."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4717a751",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:55.402940Z",
     "iopub.status.busy": "2026-08-16T15:16:55.402753Z",
     "iopub.status.idle": "2026-08-16T15:16:55.707824Z",
     "shell.execute_reply": "2026-08-16T15:16:55.707356Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(100.00,60.00)\n",
      "(0.00,0.00)\n"
     ]
    }
   ],
   "source": [
    "artist.forward(100)\n",
    "artist.left(90)\n",
    "artist.forward(60)\n",
    "print(artist.position())\n",
    "artist.reset()\n",
    "print(artist.position())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "145ac616",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Narysuj kwadrat, przemieść się (penup) na punkt (80, 80), następnie wywołaj home() i wyświetl position() — rysunek powinien pozostać na miejscu."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7184fc59",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:55.708961Z",
     "iopub.status.busy": "2026-08-16T15:16:55.708855Z",
     "iopub.status.idle": "2026-08-16T15:16:56.730813Z",
     "shell.execute_reply": "2026-08-16T15:16:56.730307Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(0.00,0.00)\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "for _ in range(4):\n",
    "    artist.forward(60)\n",
    "    artist.right(90)\n",
    "artist.penup()\n",
    "artist.goto(80, 80)\n",
    "artist.home()\n",
    "print(artist.position())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b0b8949",
   "metadata": {},
   "source": [
    "## Ukończenie (wykonaj raz, na samym końcu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f81e693c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:56.731901Z",
     "iopub.status.busy": "2026-08-16T15:16:56.731786Z",
     "iopub.status.idle": "2026-08-16T15:16:56.734832Z",
     "shell.execute_reply": "2026-08-16T15:16:56.734361Z"
    }
   },
   "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
}
