Lines Matching full:tk

1 :mod:`tkinter` --- Python interface to Tcl/Tk
5 :synopsis: Interface to Tcl/Tk for graphical user interfaces
13 The :mod:`tkinter` package ("Tk interface") is the standard Python interface to
14 the Tcl/Tk GUI toolkit. Both Tk and :mod:`tkinter` are available on most Unix
18 demonstrating a simple Tk interface, letting you know that :mod:`tkinter` is
19 properly installed on your system, and also showing what version of Tcl/Tk is
20 installed, so you can read the Tcl/Tk documentation specific to that version.
22 Tkinter supports a range of Tcl/Tk versions, built either with or
23 without thread support. The official Python binary release bundles Tcl/Tk 8.6
29 additions and changes, and refer to the official Tcl/Tk documentation for
34 Tcl/Tk 8.5 (2007) introduced a modern set of themed user interface components
48 Tcl/Tk Resources:
50 * `Tk commands <https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm>`_
51 Comprehensive reference to each of the underlying Tcl/Tk commands used by Tkinter.
53 * `Tcl/Tk Home Page <https://www.tcl.tk>`_
54 Additional documentation, and links to Tcl/Tk core development.
67 * `Tcl and the Tk Toolkit (2nd edition) <https://www.amazon.com/exec/obidos/ASIN/032133633X>`_
68 …By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does not cover Tkinter. (ISBN 978-032133633…
74 Tcl/Tk is not a single library but rather consists of a few distinct
83 interface to the Tk toolkit. The Tcl library has a C interface to
92 Tk
93 Tk is a `Tcl package <https://wiki.tcl-lang.org/37432>`_ implemented in C
95 :class:`Tk` object embeds its own Tcl interpreter instance with Tk loaded into
96 it. Tk's widgets are very customizable, though at the cost of a dated appearance.
97 Tk uses Tcl's event queue to generate and process GUI events.
100 Themed Tk (Ttk) is a newer family of Tk widgets that provide a much better
101 appearance on different platforms than many of the classic Tk widgets.
102 Ttk is distributed as part of Tk, starting with Tk version 8.5. Python
105 Internally, Tk and Ttk use facilities of the underlying operating system,
109 the :mod:`tkinter` module first assembles a Tcl/Tk command string. It passes that
112 Tk and/or Ttk packages, which will in turn make calls to Xlib, Cocoa, or GDI.
127 .. class:: Tk(screenName=None, baseName=None, className='Tk', useTk=True, sync=False, use=None)
129 Construct a toplevel Tk widget, which is usually the main window of an
133 The :class:`Tk` class is typically instantiated using all default values.
146 If ``True``, initialize the Tk subsystem. The :func:`tkinter.Tcl() <Tcl>`
159 to a Tk frame or toplevel that has its -container option enabled.
161 :class:`Tk` reads and interprets profile files, named
168 .. attribute:: tk
170 The Tk application object created by instantiating :class:`Tk`. This
172 the same instance of :class:`Tk` has the same value for its :attr:`tk`
177 The widget object that contains this widget. For :class:`Tk`, the
192 .. function:: Tcl(screenName=None, baseName=None, className='Tk', useTk=False)
195 that created by the :class:`Tk` class, except that it does not initialize the Tk
199 created by the :func:`Tcl` object can have a Toplevel window created (and the Tk
203 The modules that provide Tk support include:
221 Access to standard Tk dialog boxes.
230 Themed widget set introduced in Tk 8.5, providing modern alternatives
236 A binary module that contains the low-level interface to Tcl/Tk.
253 become deprecated when it is replaced with the Tk DND.
256 (deprecated) An older third-party Tcl/Tk package that adds several new
260 Turtle graphics in a Tk window.
266 This section is not designed to be an exhaustive tutorial on either Tk or
269 application looks like, identifies foundational Tk concepts, and
274 find more detailed documentation on them, including in the official Tcl/Tk
289 root = Tk()
297 After the imports, the next line creates an instance of the :class:`Tk` class,
298 which initializes Tk and creates its associated Tcl interpreter. It also
318 Important Tk Concepts
321 Even this simple program illustrates the following key Tk concepts:
350 Understanding How Tkinter Wraps Tcl/Tk
354 is assembling strings representing Tcl/Tk commands, and executing those
355 commands in the Tcl interpreter attached to your applicaton's :class:`Tk`
361 what those underlying Tcl/Tk commands look like.
363 To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter
408 across different versions of both Tkinter and Tcl/Tk. If you're searching
409 documentation, make sure it corresponds to the Python and Tcl/Tk versions
447 Navigating the Tcl/Tk Reference Manual
450 As noted, the official `Tk commands <https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm>`_
456 objects, you've seen that many Tcl/Tk operations appear as commands that
466 when you create a widget in Tcl/Tk, it creates a Tcl command with the name
476 In the official Tcl/Tk reference documentation, you'll find most operations
479 `ttk::button <https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm>`_
482 `grid <https://www.tcl.tk/man/tcl8.6/TkCmd/grid.htm>`_).
485 `options <https://www.tcl.tk/man/tcl8.6/TkCmd/options.htm>`_ or
486 `ttk::widget <https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_widget.htm>`_ man
492 `winfo <https://www.tcl.tk/man/tcl8.6/TkCmd/winfo.htm>`_ man page.
506 Python and Tcl/Tk have very different threading models, which :mod:`tkinter`
514 Each :class:`Tk` object created by :mod:`tkinter` contains a Tcl interpreter.
517 from a thread other than the one that created the :class:`Tk` object, an event
521 Tcl/Tk applications are normally event-driven, meaning that after initialization,
522 the interpreter runs an event loop (i.e. :func:`Tk.mainloop`) and responds to events.
536 * Tcl/Tk libraries can be built so they are not thread-aware. In this case,
541 * While :mod:`tkinter` allows you to create more than one instance of a :class:`Tk`
544 more than one instance of :class:`Tk` at a time. Otherwise, it's best to create
545 them in separate threads and ensure you're running a thread-aware Tcl/Tk build.
584 For a complete explanation of a given option and its behavior, see the Tk man
639 The packer is one of Tk's geometry-management mechanisms. Geometry managers
717 import tkinter as tk
719 class App(tk.Frame):
724 self.entrythingy = tk.Entry()
728 self.contents = tk.StringVar()
743 root = tk.Tk()
752 In Tk, there is a utility command, ``wm``, for interacting with the window
764 part of the implementation, and not an interface to Tk functionality.
768 import tkinter as tk
770 class App(tk.Frame):
788 Tk Option Data Types
791 .. index:: single: Tk Option Data Types
833 Tk uses a list font name format, such as ``{courier 10 bold}``. Font sizes with
881 :manpage:`bind(3tk)` man page, and page 201 of John Ousterhout's book,
882 :title-reference:`Tcl and the Tk Toolkit (2nd edition)`, for details).
905 they are denoted in Tk, which can be useful when referring to the Tk man pages.
908 | Tk | Tkinter Event Field | Tk | Tkinter Event Field |
941 The index notation for Text widgets is very rich and is best described in the Tk
978 is supported starting with Tk 8.6.
984 some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a
986 deleted, the image data is deleted as well, and Tk will display an empty box
999 Tk allows you to register and unregister a callback function which will be
1000 called from the Tk mainloop when I/O is possible on a file descriptor.
1004 widget = tkinter.Tk()
1006 widget.tk.createfilehandler(file, mask, callback)
1008 widget.tk.deletefilehandler(file)
1021 .. method:: Widget.tk.createfilehandler(file, mask, func)
1032 .. method:: Widget.tk.deletefilehandler(file)