77LabelFrame and PanedWindow.
88
99Properties of the widgets are specified with keyword arguments.
10- Keyword arguments have the same name as the corresponding resource
10+ Keyword arguments have the same name as the corresponding options
1111under Tk.
1212
1313Widgets are positioned with one of the geometry managers Place, Pack
1414or Grid. These managers can be called with methods place, pack, grid
1515available in every Widget.
1616
17- Actions are bound to events by resources (e.g. keyword argument
18- command ) or with the method bind.
17+ Actions are bound to events by options (e.g. the command
18+ keyword argument ) or with the bind() method .
1919
2020Example (Hello, World):
2121import tkinter
2222from tkinter.constants import *
2323tk = tkinter.Tk()
2424frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
25- frame.pack(fill=BOTH,expand=1)
25+ frame.pack(fill=BOTH, expand=1)
2626label = tkinter.Label(frame, text="Hello, World")
2727label.pack(fill=X, expand=1)
28- button = tkinter.Button(frame,text="Exit",command=tk.destroy)
28+ button = tkinter.Button(frame, text="Exit", command=tk.destroy)
2929button.pack(side=BOTTOM)
3030tk.mainloop()
3131"""
@@ -847,7 +847,7 @@ def tk_focusNext(self):
847847 The focus order first goes to the next child, then to
848848 the children of the child recursively and then to the
849849 next sibling which is higher in the stacking order. A
850- widget is omitted if it has the takefocus resource set
850+ widget is omitted if it has the takefocus option set
851851 to 0."""
852852 name = self .tk .call ('tk_focusNext' , self ._w )
853853 if not name : return None
@@ -1827,18 +1827,24 @@ def _configure(self, cmd, cnf, kw):
18271827 # These used to be defined in Widget:
18281828
18291829 def configure (self , cnf = None , ** kw ):
1830- """Configure resources of a widget.
1830+ """Query or modify the configuration options of the widget.
18311831
1832- The values for resources are specified as keyword
1833- arguments. To get an overview about
1834- the allowed keyword arguments call the method keys.
1832+ If no arguments are specified, return a dictionary describing
1833+ all of the available options for the widget.
1834+
1835+ If an option name is specified, then return a tuple describing
1836+ the one named option.
1837+
1838+ If one or more keyword arguments are specified or a dictionary
1839+ is specified, then modify the widget option(s) to have the given
1840+ value(s).
18351841 """
18361842 return self ._configure ('configure' , cnf , kw )
18371843
18381844 config = configure
18391845
18401846 def cget (self , key ):
1841- """Return the resource value for a KEY given as string ."""
1847+ """Return the current value of the configuration option ."""
18421848 return self .tk .call (self ._w , 'cget' , '-' + key )
18431849
18441850 __getitem__ = cget
@@ -1847,7 +1853,7 @@ def __setitem__(self, key, value):
18471853 self .configure ({key : value })
18481854
18491855 def keys (self ):
1850- """Return a list of all resource names of this widget."""
1856+ """Return a list of all option names of this widget."""
18511857 splitlist = self .tk .splitlist
18521858 return [splitlist (x )[0 ][1 :] for x in
18531859 splitlist (self .tk .call (self ._w , 'configure' ))]
@@ -1966,7 +1972,7 @@ def _grid_configure(self, command, index, cnf, kw):
19661972 def grid_columnconfigure (self , index , cnf = {}, ** kw ):
19671973 """Configure column INDEX of a grid.
19681974
1969- Valid resources are minsize (minimum size of the column),
1975+ Valid options are minsize (minimum size of the column),
19701976 weight (how much does additional space propagate to this column)
19711977 and pad (how much space to let additionally)."""
19721978 return self ._grid_configure ('columnconfigure' , index , cnf , kw )
@@ -1997,7 +2003,7 @@ def grid_propagate(self, flag=_noarg_):
19972003 def grid_rowconfigure (self , index , cnf = {}, ** kw ):
19982004 """Configure row INDEX of a grid.
19992005
2000- Valid resources are minsize (minimum size of the row),
2006+ Valid options are minsize (minimum size of the row),
20012007 weight (how much does additional space propagate to this row)
20022008 and pad (how much space to let additionally)."""
20032009 return self ._grid_configure ('rowconfigure' , index , cnf , kw )
@@ -2817,7 +2823,7 @@ class Toplevel(BaseWidget, Wm):
28172823 def __init__ (self , master = None , cnf = {}, ** kw ):
28182824 """Construct a toplevel widget with the parent MASTER.
28192825
2820- Valid resource names: background, bd, bg, borderwidth, class,
2826+ Valid option names: background, bd, bg, borderwidth, class,
28212827 colormap, container, cursor, height, highlightbackground,
28222828 highlightcolor, highlightthickness, menu, relief, screen, takefocus,
28232829 use, visual, width."""
@@ -2894,7 +2900,7 @@ class Canvas(Widget, XView, YView):
28942900 def __init__ (self , master = None , cnf = {}, ** kw ):
28952901 """Construct a canvas widget with the parent MASTER.
28962902
2897- Valid resource names: background, bd, bg, borderwidth, closeenough,
2903+ Valid option names: background, bd, bg, borderwidth, closeenough,
28982904 confine, cursor, height, highlightbackground, highlightcolor,
28992905 highlightthickness, insertbackground, insertborderwidth,
29002906 insertofftime, insertontime, insertwidth, offset, relief,
@@ -3103,16 +3109,14 @@ def insert(self, *args):
31033109 self .tk .call ((self ._w , 'insert' ) + args )
31043110
31053111 def itemcget (self , tagOrId , option ):
3106- """Return the resource value for an OPTION for item TAGORID."""
3112+ """Return the value of OPTION for item TAGORID."""
31073113 return self .tk .call (
31083114 (self ._w , 'itemcget' ) + (tagOrId , '-' + option ))
31093115
31103116 def itemconfigure (self , tagOrId , cnf = None , ** kw ):
3111- """Configure resources of an item TAGORID.
3117+ """Query or modify the configuration options of an item TAGORID.
31123118
3113- The values for resources are specified as keyword
3114- arguments. To get an overview about
3115- the allowed keyword arguments call the method without arguments.
3119+ Similar to configure() except that it applies to the specified item.
31163120 """
31173121 return self ._configure (('itemconfigure' , tagOrId ), cnf , kw )
31183122
@@ -3204,7 +3208,7 @@ class Checkbutton(Widget):
32043208 def __init__ (self , master = None , cnf = {}, ** kw ):
32053209 """Construct a checkbutton widget with the parent MASTER.
32063210
3207- Valid resource names: activebackground, activeforeground, anchor,
3211+ Valid option names: activebackground, activeforeground, anchor,
32083212 background, bd, bg, bitmap, borderwidth, command, cursor,
32093213 disabledforeground, fg, font, foreground, height,
32103214 highlightbackground, highlightcolor, highlightthickness, image,
@@ -3235,7 +3239,7 @@ def flash(self):
32353239 self .tk .call (self ._w , 'flash' )
32363240
32373241 def invoke (self ):
3238- """Toggle the button and invoke a command if given as resource ."""
3242+ """Toggle the button and invoke a command if given as option ."""
32393243 return self .tk .call (self ._w , 'invoke' )
32403244
32413245 def select (self ):
@@ -3253,7 +3257,7 @@ class Entry(Widget, XView):
32533257 def __init__ (self , master = None , cnf = {}, ** kw ):
32543258 """Construct an entry widget with the parent MASTER.
32553259
3256- Valid resource names: background, bd, bg, borderwidth, cursor,
3260+ Valid option names: background, bd, bg, borderwidth, cursor,
32573261 exportselection, fg, font, foreground, highlightbackground,
32583262 highlightcolor, highlightthickness, insertbackground,
32593263 insertborderwidth, insertofftime, insertontime, insertwidth,
@@ -3339,7 +3343,7 @@ class Frame(Widget):
33393343 def __init__ (self , master = None , cnf = {}, ** kw ):
33403344 """Construct a frame widget with the parent MASTER.
33413345
3342- Valid resource names: background, bd, bg, borderwidth, class,
3346+ Valid option names: background, bd, bg, borderwidth, class,
33433347 colormap, container, cursor, height, highlightbackground,
33443348 highlightcolor, highlightthickness, relief, takefocus, visual, width."""
33453349 cnf = _cnfmerge ((cnf , kw ))
@@ -3383,7 +3387,7 @@ class Listbox(Widget, XView, YView):
33833387 def __init__ (self , master = None , cnf = {}, ** kw ):
33843388 """Construct a listbox widget with the parent MASTER.
33853389
3386- Valid resource names: background, bd, bg, borderwidth, cursor,
3390+ Valid option names: background, bd, bg, borderwidth, cursor,
33873391 exportselection, fg, font, foreground, height, highlightbackground,
33883392 highlightcolor, highlightthickness, relief, selectbackground,
33893393 selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
@@ -3476,18 +3480,15 @@ def size(self):
34763480 return self .tk .getint (self .tk .call (self ._w , 'size' ))
34773481
34783482 def itemcget (self , index , option ):
3479- """Return the resource value for an ITEM and an OPTION ."""
3483+ """Return the value of OPTION for item at INDEX ."""
34803484 return self .tk .call (
34813485 (self ._w , 'itemcget' ) + (index , '-' + option ))
34823486
34833487 def itemconfigure (self , index , cnf = None , ** kw ):
3484- """Configure resources of an ITEM .
3488+ """Query or modify the configuration options of an item at INDEX .
34853489
3486- The values for resources are specified as keyword arguments.
3487- To get an overview about the allowed keyword arguments
3488- call the method without arguments.
3489- Valid resource names: background, bg, foreground, fg,
3490- selectbackground, selectforeground."""
3490+ Similar to configure() except that it applies to the specified item.
3491+ """
34913492 return self ._configure (('itemconfigure' , index ), cnf , kw )
34923493
34933494 itemconfig = itemconfigure
@@ -3499,7 +3500,7 @@ class Menu(Widget):
34993500 def __init__ (self , master = None , cnf = {}, ** kw ):
35003501 """Construct menu widget with the parent MASTER.
35013502
3502- Valid resource names: activebackground, activeborderwidth,
3503+ Valid option names: activebackground, activeborderwidth,
35033504 activeforeground, background, bd, bg, borderwidth, cursor,
35043505 disabledforeground, fg, font, foreground, postcommand, relief,
35053506 selectcolor, takefocus, tearoff, tearoffcommand, title, type."""
@@ -3580,11 +3581,15 @@ def delete(self, index1, index2=None):
35803581 self .tk .call (self ._w , 'delete' , index1 , index2 )
35813582
35823583 def entrycget (self , index , option ):
3583- """Return the resource value of a menu item for OPTION at INDEX."""
3584+ """Return the value of OPTION for a menu item at INDEX."""
35843585 return self .tk .call (self ._w , 'entrycget' , index , '-' + option )
35853586
35863587 def entryconfigure (self , index , cnf = None , ** kw ):
3587- """Configure a menu item at INDEX."""
3588+ """Query or modify the configuration options of a menu item at INDEX.
3589+
3590+ Similar to configure() except that it applies to the specified
3591+ menu item.
3592+ """
35883593 return self ._configure (('entryconfigure' , index ), cnf , kw )
35893594
35903595 entryconfig = entryconfigure
@@ -3642,7 +3647,7 @@ class Radiobutton(Widget):
36423647 def __init__ (self , master = None , cnf = {}, ** kw ):
36433648 """Construct a radiobutton widget with the parent MASTER.
36443649
3645- Valid resource names: activebackground, activeforeground, anchor,
3650+ Valid option names: activebackground, activeforeground, anchor,
36463651 background, bd, bg, bitmap, borderwidth, command, cursor,
36473652 disabledforeground, fg, font, foreground, height,
36483653 highlightbackground, highlightcolor, highlightthickness, image,
@@ -3661,7 +3666,7 @@ def flash(self):
36613666 self .tk .call (self ._w , 'flash' )
36623667
36633668 def invoke (self ):
3664- """Toggle the button and invoke a command if given as resource ."""
3669+ """Toggle the button and invoke a command if given as option ."""
36653670 return self .tk .call (self ._w , 'invoke' )
36663671
36673672 def select (self ):
@@ -3675,7 +3680,7 @@ class Scale(Widget):
36753680 def __init__ (self , master = None , cnf = {}, ** kw ):
36763681 """Construct a scale widget with the parent MASTER.
36773682
3678- Valid resource names: activebackground, background, bigincrement, bd,
3683+ Valid option names: activebackground, background, bigincrement, bd,
36793684 bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
36803685 highlightbackground, highlightcolor, highlightthickness, label,
36813686 length, orient, relief, repeatdelay, repeatinterval, resolution,
@@ -3714,7 +3719,7 @@ class Scrollbar(Widget):
37143719 def __init__ (self , master = None , cnf = {}, ** kw ):
37153720 """Construct a scrollbar widget with the parent MASTER.
37163721
3717- Valid resource names: activebackground, activerelief,
3722+ Valid option names: activebackground, activerelief,
37183723 background, bd, bg, borderwidth, command, cursor,
37193724 elementborderwidth, highlightbackground,
37203725 highlightcolor, highlightthickness, jump, orient,
@@ -3958,7 +3963,11 @@ def image_cget(self, index, option):
39583963 return self .tk .call (self ._w , "image" , "cget" , index , option )
39593964
39603965 def image_configure (self , index , cnf = None , ** kw ):
3961- """Configure an embedded image at INDEX."""
3966+ """Query or modify the configuration options of an embedded image at INDEX.
3967+
3968+ Similar to configure() except that it applies to the specified
3969+ embedded image.
3970+ """
39623971 return self ._configure (('image' , 'configure' , index ), cnf , kw )
39633972
39643973 def image_create (self , index , cnf = {}, ** kw ):
@@ -4096,7 +4105,10 @@ def tag_cget(self, tagName, option):
40964105 return self .tk .call (self ._w , 'tag' , 'cget' , tagName , option )
40974106
40984107 def tag_configure (self , tagName , cnf = None , ** kw ):
4099- """Configure a tag TAGNAME."""
4108+ """Query or modify the configuration options of a tag TAGNAME.
4109+
4110+ Similar to configure() except that it applies to the specified tag.
4111+ """
41004112 return self ._configure (('tag' , 'configure' , tagName ), cnf , kw )
41014113
41024114 tag_config = tag_configure
@@ -4154,7 +4166,11 @@ def window_cget(self, index, option):
41544166 return self .tk .call (self ._w , 'window' , 'cget' , index , option )
41554167
41564168 def window_configure (self , index , cnf = None , ** kw ):
4157- """Configure an embedded window at INDEX."""
4169+ """Query or modify the configuration options of an embedded window at INDEX.
4170+
4171+ Similar to configure() except that it applies to the specified
4172+ embedded window.
4173+ """
41584174 return self ._configure (('window' , 'configure' , index ), cnf , kw )
41594175
41604176 window_config = window_configure
@@ -4194,7 +4210,7 @@ class OptionMenu(Menubutton):
41944210
41954211 def __init__ (self , master , variable , value , * values , ** kwargs ):
41964212 """Construct an optionmenu widget with the parent MASTER, with
4197- the resource textvariable set to VARIABLE, the initially selected
4213+ the option textvariable set to VARIABLE, the initially selected
41984214 value VALUE, the other menu values VALUES and an additional
41994215 keyword argument command."""
42004216 kw = {"borderwidth" : 2 , "textvariable" : variable ,
@@ -4296,7 +4312,7 @@ class PhotoImage(Image):
42964312 def __init__ (self , name = None , cnf = {}, master = None , ** kw ):
42974313 """Create an image with NAME.
42984314
4299- Valid resource names: data, format, file, gamma, height, palette,
4315+ Valid option names: data, format, file, gamma, height, palette,
43004316 width."""
43014317 Image .__init__ (self , 'photo' , name , cnf , master , ** kw )
43024318
@@ -4559,7 +4575,7 @@ class BitmapImage(Image):
45594575 def __init__ (self , name = None , cnf = {}, master = None , ** kw ):
45604576 """Create a bitmap with NAME.
45614577
4562- Valid resource names: background, data, file, foreground, maskdata, maskfile."""
4578+ Valid option names: background, data, file, foreground, maskdata, maskfile."""
45634579 Image .__init__ (self , 'bitmap' , name , cnf , master , ** kw )
45644580
45654581
@@ -4877,26 +4893,17 @@ def sash_place(self, index, x, y):
48774893 return self .sash ("place" , index , x , y )
48784894
48794895 def panecget (self , child , option ):
4880- """Query a management option for window.
4881-
4882- Option may be any value allowed by the paneconfigure subcommand
4883- """
4896+ """Return the value of option for a child window."""
48844897 return self .tk .call (
48854898 (self ._w , 'panecget' ) + (child , '-' + option ))
48864899
48874900 def paneconfigure (self , tagOrId , cnf = None , ** kw ):
4888- """Query or modify the management options for window.
4889-
4890- If no option is specified, returns a list describing all
4891- of the available options for pathName. If option is
4892- specified with no value, then the command returns a list
4893- describing the one named option (this list will be identical
4894- to the corresponding sublist of the value returned if no
4895- option is specified). If one or more option-value pairs are
4896- specified, then the command modifies the given widget
4897- option(s) to have the given value(s); in this case the
4898- command returns an empty string. The following options
4899- are supported:
4901+ """Query or modify the configuration options for a child window.
4902+
4903+ Similar to configure() except that it applies to the specified
4904+ window.
4905+
4906+ The following options are supported:
49004907
49014908 after window
49024909 Insert the window after the window specified. window
0 commit comments