Документация Python неофициальный перевод

tk.md

142 строк · 14.5 КБ · обычная страница · сырой текст · скачать

1> **Источник:** https://python-all.ru/3.7/library/tk.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Графические пользовательские интерфейсы с Tk89Tk/Tcl уже давно является неотъемлемой частью Python. Он предоставляет надежный и независимый от платформы набор инструментов для работы с окнами, который доступен программистам Python с помощью пакета [`tkinter`](https://python-all.ru/3.7/library/tkinter.html#module-tkinter) и его расширения – модулей [`tkinter.tix`](https://python-all.ru/3.7/library/tkinter.tix.html#module-tkinter.tix) и [`tkinter.ttk`](https://python-all.ru/3.7/library/tkinter.ttk.html#module-tkinter.ttk).1011Пакет [`tkinter`](https://python-all.ru/3.7/library/tkinter.html#module-tkinter) – это тонкая объектно-ориентированная надстройка над Tcl/Tk. Для использования [`tkinter`](https://python-all.ru/3.7/library/tkinter.html#module-tkinter) не требуется писать код на Tcl, но потребуется обращаться к документации по Tk и иногда – к документации по Tcl. [`tkinter`](https://python-all.ru/3.7/library/tkinter.html#module-tkinter) – это набор обёрток, реализующих виджеты Tk в виде классов Python. Кроме того, внутренний модуль `_tkinter` предоставляет механизм для потокобезопасного взаимодействия между Python и Tcl.1213Главные достоинства [`tkinter`](https://python-all.ru/3.7/library/tkinter.html#module-tkinter) – это его быстрота и то, что он обычно поставляется в комплекте с Python. Хотя стандартная документация оставляет желать лучшего, доступны хорошие материалы: справочные руководства, учебники, книга и другое. [`tkinter`](https://python-all.ru/3.7/library/tkinter.html#module-tkinter) также известен своим устаревшим внешним видом, который значительно улучшен в Tk 8.5. Тем не менее существует множество других библиотек GUI, которые могут представлять интерес. Дополнительную информацию об альтернативах см. в разделе [Другие пакеты графических пользовательских интерфейсов](https://python-all.ru/3.7/library/othergui.html#other-gui-packages).1415- [`tkinter` – интерфейс Python к Tcl/Tk](https://python-all.ru/3.7/library/tkinter.html)1617  - [Модули Tkinter](https://python-all.ru/3.7/library/tkinter.html#tkinter-modules)18  - [Основы Tkinter](https://python-all.ru/3.7/library/tkinter.html#tkinter-life-preserver)1920    - [Как использовать этот раздел](https://python-all.ru/3.7/library/tkinter.html#how-to-use-this-section)21    - [Простая программа Hello World](https://python-all.ru/3.7/library/tkinter.html#a-simple-hello-world-program)22  - [Беглый (очень) взгляд на Tcl/Tk](https://python-all.ru/3.7/library/tkinter.html#a-very-quick-look-at-tcl-tk)23  - [Сопоставление базовых Tk с Tkinter](https://python-all.ru/3.7/library/tkinter.html#mapping-basic-tk-into-tkinter)24  - [Как связаны Tk и Tkinter](https://python-all.ru/3.7/library/tkinter.html#how-tk-and-tkinter-are-related)25  - [Удобный справочник](https://python-all.ru/3.7/library/tkinter.html#handy-reference)2627    - [Настройка параметров](https://python-all.ru/3.7/library/tkinter.html#setting-options)28    - [Packer](https://python-all.ru/3.7/library/tkinter.html#the-packer)29    - [Параметры Packer](https://python-all.ru/3.7/library/tkinter.html#packer-options)30    - [Связывание переменных виджетов](https://python-all.ru/3.7/library/tkinter.html#coupling-widget-variables)31    - [Менеджер окон](https://python-all.ru/3.7/library/tkinter.html#the-window-manager)32    - [Типы данных опций Tk](https://python-all.ru/3.7/library/tkinter.html#tk-option-data-types)33    - [Привязки и события](https://python-all.ru/3.7/library/tkinter.html#bindings-and-events)34    - [Параметр index](https://python-all.ru/3.7/library/tkinter.html#the-index-parameter)35    - [Изображения](https://python-all.ru/3.7/library/tkinter.html#images)36  - [Обработчики файлов](https://python-all.ru/3.7/library/tkinter.html#file-handlers)37- [`tkinter.ttk` – Тематические виджеты Tk](https://python-all.ru/3.7/library/tkinter.ttk.html)3839  - [Использование Ttk](https://python-all.ru/3.7/library/tkinter.ttk.html#using-ttk)40  - [Виджеты Ttk](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-widgets)41  - [Виджет](https://python-all.ru/3.7/library/tkinter.ttk.html#widget)4243    - [Стандартные параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#standard-options)44    - [Параметры прокручиваемых виджетов](https://python-all.ru/3.7/library/tkinter.ttk.html#scrollable-widget-options)45    - [Параметры метки](https://python-all.ru/3.7/library/tkinter.ttk.html#label-options)46    - [Параметры совместимости](https://python-all.ru/3.7/library/tkinter.ttk.html#compatibility-options)47    - [Состояния виджетов](https://python-all.ru/3.7/library/tkinter.ttk.html#widget-states)48    - [ttk.Widget](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-widget)49  - [Combobox](https://python-all.ru/3.7/library/tkinter.ttk.html#combobox)5051    - [Параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#options)52    - [Виртуальные события](https://python-all.ru/3.7/library/tkinter.ttk.html#virtual-events)53    - [ttk.Combobox](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-combobox)54  - [Spinbox](https://python-all.ru/3.7/library/tkinter.ttk.html#spinbox)5556    - [Параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#id1)57    - [Виртуальные события](https://python-all.ru/3.7/library/tkinter.ttk.html#id2)58    - [ttk.Spinbox](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-spinbox)59  - [Блокнот](https://python-all.ru/3.7/library/tkinter.ttk.html#notebook)6061    - [Параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#id3)62    - [Опции вкладок](https://python-all.ru/3.7/library/tkinter.ttk.html#tab-options)63    - [Идентификаторы вкладок](https://python-all.ru/3.7/library/tkinter.ttk.html#tab-identifiers)64    - [Виртуальные события](https://python-all.ru/3.7/library/tkinter.ttk.html#id4)65    - [ttk.Notebook](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-notebook)66  - [Индикатор прогресса](https://python-all.ru/3.7/library/tkinter.ttk.html#progressbar)6768    - [Параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#id5)69    - [ttk.Progressbar](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-progressbar)70  - [Разделитель](https://python-all.ru/3.7/library/tkinter.ttk.html#separator)7172    - [Параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#id6)73  - [Маркер изменения размера](https://python-all.ru/3.7/library/tkinter.ttk.html#sizegrip)7475    - [Примечания для платформ](https://python-all.ru/3.7/library/tkinter.ttk.html#platform-specific-notes)76    - [Ошибки](https://python-all.ru/3.7/library/tkinter.ttk.html#bugs)77  - [Древовидный список](https://python-all.ru/3.7/library/tkinter.ttk.html#treeview)7879    - [Параметры](https://python-all.ru/3.7/library/tkinter.ttk.html#id7)80    - [Опции элементов](https://python-all.ru/3.7/library/tkinter.ttk.html#item-options)81    - [Опции тегов](https://python-all.ru/3.7/library/tkinter.ttk.html#tag-options)82    - [Идентификаторы столбцов](https://python-all.ru/3.7/library/tkinter.ttk.html#column-identifiers)83    - [Виртуальные события](https://python-all.ru/3.7/library/tkinter.ttk.html#id8)84    - [ttk.Treeview](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-treeview)85  - [Стилизация Ttk](https://python-all.ru/3.7/library/tkinter.ttk.html#ttk-styling)8687    - [Макеты](https://python-all.ru/3.7/library/tkinter.ttk.html#layouts)88- [`tkinter.tix` – Расширяющие виджеты для Tk](https://python-all.ru/3.7/library/tkinter.tix.html)8990  - [Использование Tix](https://python-all.ru/3.7/library/tkinter.tix.html#using-tix)91  - [Виджеты Tix](https://python-all.ru/3.7/library/tkinter.tix.html#tix-widgets)9293    - [Базовые виджеты](https://python-all.ru/3.7/library/tkinter.tix.html#basic-widgets)94    - [Выбор файлов](https://python-all.ru/3.7/library/tkinter.tix.html#file-selectors)95    - [Иерархический ListBox](https://python-all.ru/3.7/library/tkinter.tix.html#hierarchical-listbox)96    - [Табличный ListBox](https://python-all.ru/3.7/library/tkinter.tix.html#tabular-listbox)97    - [Менеджеры виджетов](https://python-all.ru/3.7/library/tkinter.tix.html#manager-widgets)98    - [Типы изображений](https://python-all.ru/3.7/library/tkinter.tix.html#image-types)99    - [Прочие виджеты](https://python-all.ru/3.7/library/tkinter.tix.html#miscellaneous-widgets)100    - [Менеджер геометрии Form](https://python-all.ru/3.7/library/tkinter.tix.html#form-geometry-manager)101  - [Команды Tix](https://python-all.ru/3.7/library/tkinter.tix.html#tix-commands)102- [`tkinter.scrolledtext` – Виджет текстовой области с прокруткой](https://python-all.ru/3.7/library/tkinter.scrolledtext.html)103- [IDLE](https://python-all.ru/3.7/library/idle.html)104105  - [Меню](https://python-all.ru/3.7/library/idle.html#menus)106107    - [Меню «Файл» (оболочка и редактор)](https://python-all.ru/3.7/library/idle.html#file-menu-shell-and-editor)108    - [Меню «Правка» (оболочка и редактор)](https://python-all.ru/3.7/library/idle.html#edit-menu-shell-and-editor)109    - [Меню «Формат» (только окно редактора)](https://python-all.ru/3.7/library/idle.html#format-menu-editor-window-only)110    - [Меню «Запуск» (только окно редактора)](https://python-all.ru/3.7/library/idle.html#run-menu-editor-window-only)111    - [Меню «Оболочка» (только окно оболочки)](https://python-all.ru/3.7/library/idle.html#shell-menu-shell-window-only)112    - [Меню «Отладка» (только окно оболочки)](https://python-all.ru/3.7/library/idle.html#debug-menu-shell-window-only)113    - [Меню Options (оболочка и редактор)](https://python-all.ru/3.7/library/idle.html#options-menu-shell-and-editor)114    - [Меню Window (оболочка и редактор)](https://python-all.ru/3.7/library/idle.html#window-menu-shell-and-editor)115    - [Меню Help (оболочка и редактор)](https://python-all.ru/3.7/library/idle.html#help-menu-shell-and-editor)116    - [Контекстные меню](https://python-all.ru/3.7/library/idle.html#context-menus)117  - [Редактирование и навигация](https://python-all.ru/3.7/library/idle.html#editing-and-navigation)118119    - [Окна редактора](https://python-all.ru/3.7/library/idle.html#editor-windows)120    - [Привязки клавиш](https://python-all.ru/3.7/library/idle.html#key-bindings)121    - [Автоматические отступы](https://python-all.ru/3.7/library/idle.html#automatic-indentation)122    - [Автодополнение](https://python-all.ru/3.7/library/idle.html#completions)123    - [Подсказки вызова](https://python-all.ru/3.7/library/idle.html#calltips)124    - [Контекст кода](https://python-all.ru/3.7/library/idle.html#code-context)125    - [Окно оболочки Python](https://python-all.ru/3.7/library/idle.html#python-shell-window)126    - [Цвета текста](https://python-all.ru/3.7/library/idle.html#text-colors)127  - [Запуск и выполнение кода](https://python-all.ru/3.7/library/idle.html#startup-and-code-execution)128129    - [Использование командной строки](https://python-all.ru/3.7/library/idle.html#command-line-usage)130    - [Ошибка запуска](https://python-all.ru/3.7/library/idle.html#startup-failure)131    - [Выполнение пользовательского кода](https://python-all.ru/3.7/library/idle.html#running-user-code)132    - [Вывод пользователя в оболочке](https://python-all.ru/3.7/library/idle.html#user-output-in-shell)133    - [Разработка приложений tkinter](https://python-all.ru/3.7/library/idle.html#developing-tkinter-applications)134    - [Запуск без подпроцесса](https://python-all.ru/3.7/library/idle.html#running-without-a-subprocess)135  - [Справка и настройки](https://python-all.ru/3.7/library/idle.html#help-and-preferences)136137    - [Источники справки](https://python-all.ru/3.7/library/idle.html#help-sources)138    - [Настройка параметров](https://python-all.ru/3.7/library/idle.html#setting-preferences)139    - [IDLE в macOS](https://python-all.ru/3.7/library/idle.html#idle-on-macos)140    - [Расширения](https://python-all.ru/3.7/library/idle.html#extensions)141- [Другие пакеты графического интерфейса пользователя](https://python-all.ru/3.7/library/othergui.html)142