{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9d27ff54",
   "metadata": {},
   "source": [
    "# 16-12 · tk i ttk\n",
    "\n",
    "Praktyka do sekcji [„tk i ttk”](/pl/chapters/rozdzial-16/16-12-tk-i-ttk.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3c8c4c48",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Złóż razem klasyczne i tematyczne widgety."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aa4ee0ad",
   "metadata": {},
   "source": [
    "## Pro mainloop() w tym laptopie\n",
    "\n",
    "W normalnym życiu `.py`- pliku aplikacja jest uruchamiana przez `root.mainloop()` - To polecenie „zamraża” `root.mainloop()` zadzwonimy `root.update()` (obsługuje zdarzenia raz, bez oczekiwania) a następnie `root.destroy()` — interfejs buduje się dokładnie tak samo, po prostu bez nieskończonego oczekiwania na końcu."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9a0d252b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T21:45:10.259155Z",
     "iopub.status.busy": "2026-08-18T21:45:10.259025Z",
     "iopub.status.idle": "2026-08-18T21:45:10.373727Z",
     "shell.execute_reply": "2026-08-18T21:45:10.373203Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Text Label Button\n"
     ]
    }
   ],
   "source": [
    "import tkinter as tk\n",
    "from tkinter import ttk\n",
    "\n",
    "root = tk.Tk()\n",
    "\n",
    "text_widget = tk.Text(root, height=3, width=20)\n",
    "text_widget.pack()\n",
    "\n",
    "ttk_label = ttk.Label(root, text=\"ttk.Label\")\n",
    "ttk_label.pack()\n",
    "\n",
    "ttk_button = ttk.Button(root, text=\"ttk.Button\")\n",
    "ttk_button.pack()\n",
    "\n",
    "root.update()\n",
    "print(type(text_widget).__name__, type(ttk_label).__name__, type(ttk_button).__name__)\n",
    "root.destroy()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ffbbd608",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Dodaj ttk.Entry do tej samej formy."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "872625d3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T21:45:10.374972Z",
     "iopub.status.busy": "2026-08-18T21:45:10.374833Z",
     "iopub.status.idle": "2026-08-18T21:45:10.437356Z",
     "shell.execute_reply": "2026-08-18T21:45:10.436838Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Entry\n"
     ]
    }
   ],
   "source": [
    "root = tk.Tk()\n",
    "entry = ttk.Entry(root)\n",
    "entry.pack()\n",
    "root.update()\n",
    "print(type(entry).__name__)\n",
    "root.destroy()"
   ]
  }
 ],
 "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
}
