Modern Tkinter
Class API Reference for Tkinter.

Tkinter Class API Reference Contents

Tkinter Class API Reference

Tk Application Root

tkinter.Tk(screenName=None, baseName=None, className='Tk', useTk=True, sync=False, use=None)

Toplevel widget of Tk which represents mostly the main window of an application. It has an associated Tcl interpreter.

Global Methods:

Note: The following methods are available on all widgets, but work globally rather than acting on an individual widget. By convention, they are usually invoked on the application root window.

bell(displayof=0)
deletecommand(name)
getboolean(s)
getdouble(s)
getint(s)
getvar(name='PY_VAR')
mainloop(n=0)
nametowidget(name)
quit()
send(interp, cmd, *args)
setvar(name='PY_VAR', value='1')
after(ms, func=None, *args)
after_cancel(id)
after_idle(func, *args)
clipboard_append(string, **kw)
clipboard_clear(**kw)
clipboard_get(**kw)
event_add(virtual, *sequences)
event_delete(virtual, *sequences)
event_generate(sequence, **kw)
event_info(virtual=None)
image_names()
image_types()
option_add(pattern, value, priority=None)
option_clear()
option_get(name, className)
option_readfile(fileName, priority=None)
selection_clear(**kw)
selection_get(**kw)
selection_handle(command, **kw)
selection_own(**kw)
selection_own_get(**kw)
tk_bisque()
tk_focusFollowsMouse()
tk_focusNext()
tk_focusPrev()
tk_setPalette(*args, **kw)
tk_strictMotif(boolean=None)
update()
update_idletasks()
wait_variable(name='PY_VAR') ... aka waitvar
wait_visibility(window=None)
wait_window(window=None)

Standard Methods for All Widgets

bindtags(tagList=None)
cget(key)
configure(cnf=None, **kw) ... aka config
destroy()
keys()
lower(belowThis=None)
tkraise(aboveThis=None) ... aka lift
bind(sequence=None, func=None, add=None)
bind_all(sequence=None, func=None, add=None)
bind_class(className, sequence=None, func=None, add=None)
unbind(sequence, funcid=None)
unbind_all(sequence)
unbind_class(className, sequence)
focus_displayof()
focus_force()
focus_get()
focus_lastfor()
focus_set() ... aka focus
grab_current()
grab_release()
grab_set()
grab_set_global()
grab_status()
grid_anchor(anchor=None) ... aka anchor
grid_bbox(column=None, row=None, col2=None, row2=None) ... aka bbox
grid_columnconfigure(index, cnf={}, **kw) ... aka columnconfigure
grid_configure(cnf={}, **kw) ... aka grid
grid_forget()
grid_info()
grid_location(x, y) ... aka location
grid_propagate(flag=)
grid_remove()
grid_rowconfigure(index, cnf={}, **kw) ... aka rowconfigure
grid_size() ... aka size
grid_slaves(row=None, column=None)
pack_configure(cnf={}, **kw) ... aka pack
pack_forget() ... aka forget
pack_info() ... aka info
pack_propagate(flag=) ... aka propagate
pack_slaves() ... aka slaves
place_configure(cnf={}, **kw) ... aka place
place_forget()
place_info()
place_slaves()
winfo_atom(name, displayof=0)
winfo_atomname(id, displayof=0)
winfo_cells()
winfo_children()
winfo_class()
winfo_colormapfull()
winfo_containing(rootX, rootY, displayof=0)
winfo_depth()
winfo_exists()
winfo_fpixels(number)
winfo_geometry()
winfo_height()
winfo_id()
winfo_interps(displayof=0)
winfo_ismapped()
winfo_manager()
winfo_name()
winfo_parent()
winfo_pathname(id, displayof=0)
winfo_pixels(number)
winfo_pointerx()
winfo_pointerxy()
winfo_pointery()
winfo_reqheight()
winfo_reqwidth()
winfo_rgb(color)
winfo_rootx()
winfo_rooty()
winfo_screen()
winfo_screencells()
winfo_screendepth()
winfo_screenheight()
winfo_screenmmheight()
winfo_screenmmwidth()
winfo_screenvisual()
winfo_screenwidth()
winfo_server()
winfo_toplevel()
winfo_viewable()
winfo_visual()
winfo_visualid()
winfo_visualsavailable(includeids=False)
winfo_vrootheight()
winfo_vrootwidth()
winfo_vrootx()
winfo_vrooty()
winfo_width()
winfo_x()
winfo_y()

Additional Methods for Ttk Widgets

identify(x, y)
instate(statespec, callback=None, *args, **kw)
state(statespec=None)

Ttk (Themed) Widgets

tkinter.ttk.Button(master=None, **kw)

Ttk Button widget, displays a textual label and/or image, and evaluates a command when pressed.

invoke()

Configuration Options: command, default, takefocus, text, textvariable, underline, width, image, compound, padding, state, cursor, style, class

tkinter.ttk.Checkbutton(master=None, **kw)

Ttk Checkbutton widget which is either in on- or off-state.

invoke()

Configuration Options: variable, onvalue, offvalue, command, takefocus, text, textvariable, underline, width, image, compound, padding, state, cursor, style, class

tkinter.ttk.Combobox(master=None, **kw)

Ttk Combobox widget combines a text field with a pop-down list of values.

current(newindex=None)
delete(first, last=None)
get()
icursor(index)
index(index)
insert(index, string)
set(value)
validate()
scan_dragto(x)
scan_mark(x)
selection_adjust(index) ... aka select_adjust
selection_from(index) ... aka select_from
selection_present() ... aka select_present
selection_range(start, end) ... aka select_range
selection_to(index) ... aka select_to
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)

Configuration Options: height, postcommand, values, exportselection, font, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width, xscrollcommand, foreground, background, takefocus, cursor, style, class

tkinter.ttk.Entry(master=None, widget=None, **kw)

Ttk Entry widget displays a one-line text string and allows that string to be edited by the user.

delete(first, last=None)
get()
icursor(index)
index(index)
insert(index, string)
validate()
scan_dragto(x)
scan_mark(x)
selection_adjust(index) ... aka select_adjust
selection_from(index) ... aka select_from
selection_present() ... aka select_present
selection_range(start, end) ... aka select_range
selection_to(index) ... aka select_to
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)

Configuration Options: exportselection, font, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width, xscrollcommand, foreground, background, takefocus, cursor, style, class

tkinter.ttk.Frame(master=None, **kw)

Ttk Frame widget is a container, used to group other widgets together.

Configuration Options: borderwidth, padding, relief, width, height, takefocus, cursor, style, class

tkinter.ttk.Label(master=None, **kw)

Ttk Label widget displays a textual label and/or image.

Configuration Options: background, foreground, font, borderwidth, relief, anchor, justify, wraplength, takefocus, text, textvariable, underline, width, image, compound, padding, state, cursor, style, class

tkinter.ttk.LabeledScale(master=None, variable=None, from_=0, to=10, **kw)

A Ttk Scale widget with a Ttk Label widget indicating its current value. The Ttk Scale can be accessed through instance.scale, and Ttk Label can be accessed through instance.label

value()

Configuration Options: borderwidth, padding, relief, width, height, takefocus, cursor, style, class

tkinter.ttk.Labelframe(master=None, **kw)

Ttk Labelframe widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget.

Configuration Options: labelanchor, text, underline, labelwidget, borderwidth, padding, relief, width, height, takefocus, cursor, style, class

tkinter.ttk.Menubutton(master=None, **kw)

Ttk Menubutton widget displays a textual label and/or image, and displays a menu when pressed.

Configuration Options: menu, direction, takefocus, text, textvariable, underline, width, image, compound, padding, state, cursor, style, class

tkinter.ttk.Notebook(master=None, **kw)

Ttk Notebook widget manages a collection of windows and displays a single one at a time.

add(child, **kw)
hide(tab_id)
index(tab_id)
insert(pos, child, **kw)
select(tab_id=None)
tab(tab_id, option=None, **kw)
tabs()
enable_traversal()

Configuration Options: width, height, padding, takefocus, cursor, style, class

tkinter.ttk.OptionMenu(master, variable, default=None, *values, **kwargs)

Themed OptionMenu, based after tkinter's OptionMenu, which allows the user to select a value from a menu.

set_menu()

Configuration Options:

tkinter.ttk.Panedwindow(master=None, **kw)

Ttk Panedwindow widget displays a number of subwindows, stacked either vertically or horizontally.

add(child, **kw)
insert(pos, child, **kw)
pane(pane, option=None, **kw)
panecget(child, option)
paneconfigure(tagOrId, cnf=None, **kw) ... aka paneconfig
panes()
remove(child) ... aka forget
sashpos(index, newpos=None)
proxy(*args)
proxy_coord()
proxy_forget()
proxy_place(x, y)
sash(*args)
sash_coord(index)
sash_mark(index)
sash_place(index, x, y)

Configuration Options: orient, width, height, takefocus, cursor, style, class

tkinter.ttk.Progressbar(master=None, **kw)

Ttk Progressbar widget shows the status of a long-running operation.

start(interval=None)
step(amount=None)
stop()

Configuration Options: orient, length, mode, maximum, variable, value, phase, takefocus, cursor, style, class

tkinter.ttk.Radiobutton(master=None, **kw)

Ttk Radiobutton widgets are used in groups to show or change a set of mutually-exclusive options.

invoke()

Configuration Options: variable, value, command, takefocus, text, textvariable, underline, width, image, compound, padding, state, cursor, style, class

tkinter.ttk.Scale(master=None, **kw)

Ttk Scale widget is typically used to control the numeric value of a linked variable that varies uniformly over some range.

coords(value=None)
get(x=None, y=None)
set(value)

Configuration Options: command, variable, orient, from, to, value, length, state, takefocus, cursor, style, class

tkinter.ttk.Scrollbar(master=None, **kw)

Ttk Scrollbar controls the viewport of a scrollable widget.

activate(index=None)
delta(deltax, deltay)
fraction(x, y)
get()
set(first, last)

Configuration Options: command, orient, takefocus, cursor, style, class

tkinter.ttk.Separator(master=None, **kw)

Ttk Separator widget displays a horizontal or vertical separator bar.

Configuration Options: orient, takefocus, cursor, style, class

tkinter.ttk.Sizegrip(master=None, **kw)

Ttk Sizegrip allows the user to resize the containing toplevel window by pressing and dragging the grip.

Configuration Options: takefocus, cursor, style, class

tkinter.ttk.Spinbox(master=None, **kw)

Ttk Spinbox is an Entry with increment and decrement arrows It is commonly used for number entry or to select from a list of string values.

delete(first, last=None)
get()
icursor(index)
index(index)
insert(index, string)
set(value)
validate()
scan_dragto(x)
scan_mark(x)
selection_adjust(index) ... aka select_adjust
selection_from(index) ... aka select_from
selection_present() ... aka select_present
selection_range(start, end) ... aka select_range
selection_to(index) ... aka select_to
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)

Configuration Options: values, from, to, increment, format, command, wrap, exportselection, font, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width, xscrollcommand, foreground, background, takefocus, cursor, style, class

tkinter.ttk.Treeview(master=None, **kw)

Ttk Treeview widget displays a hierarchical collection of items.

column(column, option=None, **kw)
delete(*items)
detach(*items)
exists(item)
heading(column, option=None, **kw)
index(item)
insert(parent, index, iid=None, **kw)
item(item, option=None, **kw)
move(item, parent, index) ... aka reattach
next(item)
parent(item)
prev(item)
see(item)
get_children(item=None)
identify_column(x)
identify_element(x, y)
identify_region(x, y)
identify_row(y)
selection()
selection_add(*items)
selection_remove(*items)
selection_set(*items)
selection_toggle(*items)
set(item, column=None, value=None)
set_children(item, *newchildren)
tag_bind(tagname, sequence=None, callback=None)
tag_configure(tagname, option=None, **kw)
tag_has(tagname, item=None)
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)
yview(*args)
yview_moveto(fraction)
yview_scroll(number, what)

Configuration Options: columns, displaycolumns, show, selectmode, height, padding, xscrollcommand, yscrollcommand, takefocus, cursor, style, class

Classic Widgets with no Themed Counterpart

tkinter.Canvas(master=None, cnf={}, **kw)

Canvas widget to display graphical elements like lines or text.

canvasx(screenx, gridspacing=None)
canvasy(screeny, gridspacing=None)
coords(*args)
dchars(*args)
delete(*args)
dtag(*args)
gettags(*args)
icursor(*args)
index(*args)
insert(*args)
itemcget(tagOrId, option)
itemconfigure(tagOrId, cnf=None, **kw) ... aka itemconfig
move(*args)
moveto(tagOrId, x='', y='')
postscript(cnf={}, **kw)
scale(*args)
type(tagOrId)
addtag(*args)
addtag_above(newtag, tagOrId)
addtag_all(newtag)
addtag_below(newtag, tagOrId)
addtag_closest(newtag, x, y, halo=None, start=None)
addtag_enclosed(newtag, x1, y1, x2, y2)
addtag_overlapping(newtag, x1, y1, x2, y2)
addtag_withtag(newtag, tagOrId)
create_arc(*args, **kw)
create_bitmap(*args, **kw)
create_image(*args, **kw)
create_line(*args, **kw)
create_oval(*args, **kw)
create_polygon(*args, **kw)
create_rectangle(*args, **kw)
create_text(*args, **kw)
create_window(*args, **kw)
find(*args)
find_above(tagOrId)
find_all()
find_below(tagOrId)
find_closest(x, y, halo=None, start=None)
find_enclosed(x1, y1, x2, y2)
find_overlapping(x1, y1, x2, y2)
find_withtag(tagOrId)
scan_dragto(x, y, gain=10)
scan_mark(x, y)
select_adjust(tagOrId, index)
select_clear()
select_from(tagOrId, index)
select_item()
select_to(tagOrId, index)
tag_bind(tagOrId, sequence=None, func=None, add=None)
tag_lower(*args) ... aka lower
tag_raise(*args) ... aka tkraise
tag_unbind(tagOrId, sequence, funcid=None)
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)
yview(*args)
yview_moveto(fraction)
yview_scroll(number, what)

Configuration Options: background, bd, bg, borderwidth, closeenough, confine, cursor, height, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, offset, relief, scrollregion, selectbackground, selectborderwidth, selectforeground, state, takefocus, width, xscrollcommand, xscrollincrement, yscrollcommand, yscrollincrement

tkinter.Listbox(master=None, cnf={}, **kw)

Listbox widget which can display a list of strings.

activate(index)
curselection()
delete(first, last=None)
get(first, last=None)
index(index)
insert(index, *elements)
itemcget(index, option)
itemconfigure(index, cnf=None, **kw) ... aka itemconfig
nearest(y)
see(index)
scan_dragto(x, y)
scan_mark(x, y)
selection_anchor(index) ... aka select_anchor
selection_includes(index) ... aka select_includes
selection_set(first, last=None) ... aka select_set
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)
yview(*args)
yview_moveto(fraction)
yview_scroll(number, what)

Configuration Options: activestyle, background, bd, bg, borderwidth, cursor, disabledforeground, exportselection, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, justify, relief, selectbackground, selectborderwidth, selectforeground, selectmode, setgrid, state, takefocus, width, xscrollcommand, yscrollcommand, listvariable

tkinter.Menu(master=None, cnf={}, **kw)

Menu widget which allows displaying menu bars, pull-down menus and pop-up menus.

activate(index)
delete(index1, index2=None)
entrycget(index, option)
entryconfigure(index, cnf=None, **kw) ... aka entryconfig
index(index)
invoke(index)
post(x, y)
type(index)
unpost()
xposition(index)
yposition(index)
add(itemType, cnf={}, **kw)
add_cascade(cnf={}, **kw)
add_checkbutton(cnf={}, **kw)
add_command(cnf={}, **kw)
add_radiobutton(cnf={}, **kw)
add_separator(cnf={}, **kw)
insert(index, itemType, cnf={}, **kw)
insert_cascade(index, cnf={}, **kw)
insert_checkbutton(index, cnf={}, **kw)
insert_command(index, cnf={}, **kw)
insert_radiobutton(index, cnf={}, **kw)
insert_separator(index, cnf={}, **kw)
tk_popup(x, y, entry='')

Configuration Options: activebackground, activeborderwidth, activeforeground, background, bd, bg, borderwidth, cursor, disabledforeground, fg, font, foreground, postcommand, relief, selectcolor, takefocus, tearoff, tearoffcommand, title, type

tkinter.Text(master=None, cnf={}, **kw)

Text widget which can display text in various forms.

compare(index1, op, index2)
count(index1, index2, *args)
debug(boolean=None)
delete(index1, index2=None)
dlineinfo(index)
dump(index1, index2=None, command=None, **kw)
get(index1, index2=None)
index(index)
insert(index, chars, *args)
replace(index1, index2, chars, *args)
search(pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None, elide=None)
see(index)
edit(*args)
edit_modified(arg=None)
edit_redo()
edit_reset()
edit_separator()
edit_undo()
image_cget(index, option)
image_configure(index, cnf=None, **kw)
image_create(index, cnf={}, **kw)
mark_gravity(markName, direction=None)
mark_names()
mark_next(index)
mark_previous(index)
mark_set(markName, index)
mark_unset(*markNames)
peer_create(newPathName, cnf={}, **kw)
peer_names()
scan_dragto(x, y)
scan_mark(x, y)
tag_add(tagName, index1, *args)
tag_bind(tagName, sequence, func, add=None)
tag_cget(tagName, option)
tag_configure(tagName, cnf=None, **kw) ... aka tag_config
tag_delete(*tagNames)
tag_lower(tagName, belowThis=None)
tag_names(index=None)
tag_nextrange(tagName, index1, index2=None)
tag_prevrange(tagName, index1, index2=None)
tag_raise(tagName, aboveThis=None)
tag_ranges(tagName)
tag_remove(tagName, index1, index2=None)
tag_unbind(tagName, sequence, funcid=None)
window_cget(index, option)
window_configure(index, cnf=None, **kw) ... aka window_config
window_create(index, cnf={}, **kw)
window_names()
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)
yview(*args)
yview_moveto(fraction)
yview_pickplace(*what)
yview_scroll(number, what)

Configuration Options: autoseparators, background, bd, bg, blockcursor, borderwidth, cursor, endline, exportselection, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, inactiveselectbackground, insertbackground, insertborderwidth, insertofftime, insertontime, insertunfocussed, insertwidth, maxundo, padx, pady, relief, selectbackground, selectborderwidth, selectforeground, setgrid, spacing1, spacing2, spacing3, startline, state, tabs, tabstyle, takefocus, undo, width, wrap, xscrollcommand, yscrollcommand

tkinter.Toplevel(master=None, cnf={}, **kw)

Toplevel widget, e.g. for dialogs.

wm_aspect(minNumer=None, minDenom=None, maxNumer=None, maxDenom=None) ... aka aspect
wm_attributes(*args) ... aka attributes
wm_client(name=None) ... aka client
wm_colormapwindows(*wlist) ... aka colormapwindows
wm_command(value=None) ... aka command
wm_deiconify() ... aka deiconify
wm_focusmodel(model=None) ... aka focusmodel
wm_forget(window) ... aka forget
wm_frame() ... aka frame
wm_geometry(newGeometry=None) ... aka geometry
wm_grid(baseWidth=None, baseHeight=None, widthInc=None, heightInc=None) ... aka grid
wm_group(pathName=None) ... aka group
wm_iconbitmap(bitmap=None, default=None) ... aka iconbitmap
wm_iconify() ... aka iconify
wm_iconmask(bitmap=None) ... aka iconmask
wm_iconname(newName=None) ... aka iconname
wm_iconphoto(default=False, *args) ... aka iconphoto
wm_iconposition(x=None, y=None) ... aka iconposition
wm_iconwindow(pathName=None) ... aka iconwindow
wm_manage(widget) ... aka manage
wm_maxsize(width=None, height=None) ... aka maxsize
wm_minsize(width=None, height=None) ... aka minsize
wm_overrideredirect(boolean=None) ... aka overrideredirect
wm_positionfrom(who=None) ... aka positionfrom
wm_protocol(name=None, func=None) ... aka protocol
wm_resizable(width=None, height=None) ... aka resizable
wm_sizefrom(who=None) ... aka sizefrom
wm_state(newstate=None) ... aka state
wm_title(string=None) ... aka title
wm_transient(master=None) ... aka transient
wm_withdraw() ... aka withdraw

Configuration Options: bd, borderwidth, class, menu, relief, screen, use, background, bg, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, padx, pady, takefocus, visual, width

Classic Widgets Where a Themed Replacement is Available

tkinter.Button(master=None, cnf={}, **kw)

Button widget.

flash()
invoke()

Configuration Options: activebackground, activeforeground, anchor, background, bd, bg, bitmap, borderwidth, command, compound, cursor, default, disabledforeground, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, image, justify, overrelief, padx, pady, relief, repeatdelay, repeatinterval, state, takefocus, text, textvariable, underline, width, wraplength

tkinter.Checkbutton(master=None, cnf={}, **kw)

Checkbutton widget which is either in on- or off-state.

deselect()
flash()
invoke()
select()
toggle()

Configuration Options: activebackground, activeforeground, anchor, background, bd, bg, bitmap, borderwidth, command, compound, cursor, disabledforeground, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, image, indicatoron, justify, offrelief, offvalue, onvalue, overrelief, padx, pady, relief, selectcolor, selectimage, state, takefocus, text, textvariable, tristateimage, tristatevalue, underline, variable, width, wraplength

tkinter.Entry(master=None, cnf={}, **kw)

Entry widget which allows displaying simple text.

delete(first, last=None)
get()
icursor(index)
index(index)
insert(index, string)
scan_dragto(x)
scan_mark(x)
selection_adjust(index) ... aka select_adjust
selection_from(index) ... aka select_from
selection_present() ... aka select_present
selection_range(start, end) ... aka select_range
selection_to(index) ... aka select_to
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)

Configuration Options: background, bd, bg, borderwidth, cursor, disabledbackground, disabledforeground, exportselection, fg, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, invalidcommand, invcmd, justify, readonlybackground, relief, selectbackground, selectborderwidth, selectforeground, show, state, takefocus, textvariable, validate, validatecommand, vcmd, width, xscrollcommand

tkinter.Frame(master=None, cnf={}, **kw)

Frame widget which may contain other widgets and can have a 3D border.

Configuration Options: bd, borderwidth, class, relief, background, bg, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, padx, pady, takefocus, visual, width

tkinter.Label(master=None, cnf={}, **kw)

Label widget which can display text and bitmaps.

Configuration Options: activebackground, activeforeground, anchor, background, bd, bg, bitmap, borderwidth, compound, cursor, disabledforeground, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, image, justify, padx, pady, relief, state, takefocus, text, textvariable, underline, width, wraplength

tkinter.LabelFrame(master=None, cnf={}, **kw)

labelframe widget.

Configuration Options: bd, borderwidth, class, fg, font, foreground, labelanchor, labelwidget, relief, text, background, bg, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, padx, pady, takefocus, visual, width

tkinter.Menubutton(master=None, cnf={}, **kw)

Menubutton widget, obsolete since Tk8.0.

Configuration Options: activebackground, activeforeground, anchor, background, bd, bg, bitmap, borderwidth, cursor, direction, disabledforeground, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, image, indicatoron, justify, menu, padx, pady, relief, compound, state, takefocus, text, textvariable, underline, width, wraplength

tkinter.Message(master=None, cnf={}, **kw)

Message widget to display multiline text. Obsolete since Label does it too.

Configuration Options: anchor, aspect, background, bd, bg, borderwidth, cursor, fg, font, foreground, highlightbackground, highlightcolor, highlightthickness, justify, padx, pady, relief, takefocus, text, textvariable, width

tkinter.OptionMenu(master, variable, value, *values, **kwargs)

OptionMenu which allows the user to select a value from a menu.

Configuration Options:

tkinter.PanedWindow(master=None, cnf={}, **kw)

panedwindow widget.

add(child, **kw)
identify(x, y)
panecget(child, option)
paneconfigure(tagOrId, cnf=None, **kw) ... aka paneconfig
panes()
remove(child) ... aka forget
proxy(*args)
proxy_coord()
proxy_forget()
proxy_place(x, y)
sash(*args)
sash_coord(index)
sash_mark(index)
sash_place(index, x, y)

Configuration Options: background, bd, bg, borderwidth, cursor, handlepad, handlesize, height, opaqueresize, orient, proxybackground, proxyborderwidth, proxyrelief, relief, sashcursor, sashpad, sashrelief, sashwidth, showhandle, width

tkinter.Radiobutton(master=None, cnf={}, **kw)

Radiobutton widget which shows only one of several buttons in on-state.

deselect()
flash()
invoke()
select()

Configuration Options: activebackground, activeforeground, anchor, background, bd, bg, bitmap, borderwidth, command, compound, cursor, disabledforeground, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, image, indicatoron, justify, offrelief, overrelief, padx, pady, relief, selectcolor, selectimage, state, takefocus, text, textvariable, tristateimage, tristatevalue, underline, value, variable, width, wraplength

tkinter.Scale(master=None, cnf={}, **kw)

Scale widget which can display a numerical scale.

coords(value=None)
get()
identify(x, y)
set(value)

Configuration Options: activebackground, background, bigincrement, bd, bg, borderwidth, command, cursor, digits, fg, font, foreground, from, highlightbackground, highlightcolor, highlightthickness, label, length, orient, relief, repeatdelay, repeatinterval, resolution, showvalue, sliderlength, sliderrelief, state, takefocus, tickinterval, to, troughcolor, variable, width

tkinter.Scrollbar(master=None, cnf={}, **kw)

Scrollbar widget which displays a slider at a certain position.

activate(index=None)
delta(deltax, deltay)
fraction(x, y)
get()
identify(x, y)
set(first, last)

Configuration Options: activebackground, activerelief, background, bd, bg, borderwidth, command, cursor, elementborderwidth, highlightbackground, highlightcolor, highlightthickness, jump, orient, relief, repeatdelay, repeatinterval, takefocus, troughcolor, width

tkinter.Spinbox(master=None, cnf={}, **kw)

spinbox widget.

delete(first, last=None)
get()
icursor(index)
identify(x, y)
index(index)
insert(index, s)
invoke(element)
scan(*args)
scan_dragto(x)
scan_mark(x)
selection(*args)
selection_adjust(index)
selection_element(element=None)
selection_from(index)
selection_present()
selection_range(start, end)
selection_to(index)
xview(*args)
xview_moveto(fraction)
xview_scroll(number, what)

Configuration Options: activebackground, background, bd, bg, borderwidth, buttonbackground, buttoncursor, buttondownrelief, buttonuprelief, command, cursor, disabledbackground, disabledforeground, exportselection, fg, font, foreground, format, from, highlightbackground, highlightcolor, highlightthickness, increment, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, invalidcommand, invcmd, justify, relief, readonlybackground, repeatdelay, repeatinterval, selectbackground, selectborderwidth, selectforeground, state, takefocus, textvariable, to, validate, validatecommand, values, vcmd, width, wrap, xscrollcommand

Additional Classes

Variables

tkinter.Variable(master=None, value=None, name=None)

Class to define value holders for e.g. buttons. Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations that constrain the type of the value returned from get().

tkinter.BooleanVar(master=None, value=None, name=None)

Value holder for boolean variables.

tkinter.DoubleVar(master=None, value=None, name=None)

Value holder for float variables.

tkinter.IntVar(master=None, value=None, name=None)

Value holder for integer variables.

tkinter.StringVar(master=None, value=None, name=None)

Value holder for strings variables.

get()
set(value) ... aka initialize
trace_add(mode, callback)
trace_info()
trace_remove(mode, cbname)
trace_variable(mode, callback) ... aka trace
trace_vdelete(mode, cbname)
trace_vinfo()

Images

tkinter.BitmapImage(name=None, cnf={}, master=None, **kw)

Widget which can display images in XBM format.

configure(**kw) ... aka config
height()
type()
width()

tkinter.PhotoImage(name=None, cnf={}, master=None, **kw)

Widget which can display images in PGM, PPM, GIF, PNG format.

blank()
cget(option)
configure(**kw) ... aka config
copy()
get(x, y)
height()
put(data, to=None)
subsample(x, y='')
type()
width()
write(filename, format=None, from_coords=None)
zoom(x, y='')
transparency_get(x, y)
transparency_set(x, y, boolean)

Dialogs

tkinter.filedialog.Directory(master=None, **options)

Ask for a directory

command()
show(**options)

tkinter.filedialog.Open(master=None, **options)

Ask for a filename to open

command()
show(**options)

tkinter.filedialog.SaveAs(master=None, **options)

Ask for a filename to save as

command()
show(**options)

tkinter.colorchooser.Chooser(master=None, **options)

Create a dialog for the tk_chooseColor command.

command()
show(**options)

Other

tkinter.ttk.Style(master=None)

Manipulate style database.

configure(style, query_opt=None, **kw)
layout(style, layoutspec=None)
lookup(style, option, state=None, default=None)
map(style, query_opt=None, **kw)
element_create(elementname, etype, *args, **kw)
element_names()
element_options(elementname)
theme_create(themename, parent=None, settings=None)
theme_names()
theme_settings(themename, settings)
theme_use(themename=None)

tkinter.font.Font(root=None, font=None, name=None, exists=False, **options)

Represents a named font.

actual(option=None, displayof=None)
cget(option)
config(**options) ... aka configure
copy()
counter()
measure(text, displayof=None)
metrics(*options, **kw)