@@ -63,16 +63,72 @@ the modern themed widget set and API::
63
63
from tkinter import ttk
64
64
65
65
66
- .. class :: Tk(screenName=None, baseName=None, className='Tk', useTk=1)
67
-
68
- The :class: `Tk ` class is instantiated without arguments. This creates a toplevel
69
- widget of Tk which usually is the main window of an application. Each instance
70
- has its own associated Tcl interpreter.
71
-
72
- .. FIXME: The following keyword arguments are currently recognized:
73
-
74
-
75
- .. function :: Tcl(screenName=None, baseName=None, className='Tk', useTk=0)
66
+ .. class :: Tk(screenName=None, baseName=None, className='Tk', useTk=True, sync=False, use=None)
67
+
68
+ Construct a toplevel Tk widget, which is usually the main window of an
69
+ application, and initialize a Tcl interpreter for this widget. Each
70
+ instance has its own associated Tcl interpreter.
71
+
72
+ The :class: `Tk ` class is typically instantiated using all default values.
73
+ However, the following keyword arguments are currently recognized:
74
+
75
+ *screenName *
76
+ When given (as a string), sets the :envvar: `DISPLAY ` environment
77
+ variable. (X11 only)
78
+ *baseName *
79
+ Name of the profile file. By default, *baseName * is derived from the
80
+ program name (``sys.argv[0] ``).
81
+ *className *
82
+ Name of the widget class. Used as a profile file and also as the name
83
+ with which Tcl is invoked (*argv0 * in *interp *).
84
+ *useTk *
85
+ If ``True ``, initialize the Tk subsystem. The :func: `tkinter.Tcl() <Tcl> `
86
+ function sets this to ``False ``.
87
+ *sync *
88
+ If ``True ``, execute all X server commands synchronously, so that errors
89
+ are reported immediately. Can be used for debugging. (X11 only)
90
+ *use *
91
+ Specifies the *id * of the window in which to embed the application,
92
+ instead of it being created as an independent toplevel window. *id * must
93
+ be specified in the same way as the value for the -use option for
94
+ toplevel widgets (that is, it has a form like that returned by
95
+ :meth: `winfo_id `).
96
+
97
+ Note that on some platforms this will only work correctly if *id * refers
98
+ to a Tk frame or toplevel that has its -container option enabled.
99
+
100
+ :class: `Tk ` reads and interprets profile files, named
101
+ :file: `.{ className } .tcl ` and :file: `.{ baseName } .tcl `, into the Tcl
102
+ interpreter and calls :func: `exec ` on the contents of
103
+ :file: `.{ className } .py ` and :file: `.{ baseName } .py `. The path for the
104
+ profile files is the :envvar: `HOME ` environment variable or, if that
105
+ isn't defined, then :attr: `os.curdir `.
106
+
107
+ .. attribute :: tk
108
+
109
+ The Tk application object created by instantiating :class: `Tk `. This
110
+ provides access to the Tcl interpreter. Each widget that is attached
111
+ the same instance of :class: `Tk ` has the same value for its :attr: `tk `
112
+ attribute.
113
+
114
+ .. attribute :: master
115
+
116
+ The widget object that contains this widget. For :class: `Tk `, the
117
+ *master * is :const: `None ` because it is the main window. The terms
118
+ *master * and *parent * are similar and sometimes used interchangeably
119
+ as argument names; however, calling :meth: `winfo_parent ` returns a
120
+ string of the widget name whereas :attr: `master ` returns the object.
121
+ *parent */*child * reflects the tree-like relationship while
122
+ *master */*slave * reflects the container structure.
123
+
124
+ .. attribute :: children
125
+
126
+ The immediate descendants of this widget as a :class: `dict ` with the
127
+ child widget names as the keys and the child instance objects as the
128
+ values.
129
+
130
+
131
+ .. function :: Tcl(screenName=None, baseName=None, className='Tk', useTk=False)
76
132
77
133
The :func: `Tcl ` function is a factory function which creates an object much like
78
134
that created by the :class: `Tk ` class, except that it does not initialize the Tk
0 commit comments