Module Tkinter
[hide private]
[frames] | no frames]

Module Tkinter

Wrapper functions for Tcl/Tk.

Tkinter provides classes which allow the display, positioning and control of widgets. Toplevel widgets are Tk and Toplevel. Other widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox LabelFrame and PanedWindow.

Properties of the widgets are specified with keyword arguments. Keyword arguments have the same name as the corresponding resource under Tk.

Widgets are positioned with one of the geometry managers Place, Pack or Grid. These managers can be called with methods place, pack, grid available in every Widget.

Actions are bound to events by resources (e.g. keyword argument command) or with the method bind.

Example (Hello, World): import Tkinter from Tkconstants import * tk = Tkinter.Tk() frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2) frame.pack(fill=BOTH,expand=1) label = Tkinter.Label(frame, text="Hello, World") label.pack(fill=X, expand=1) button = Tkinter.Button(frame,text="Exit",command=tk.destroy) button.pack(side=BOTTOM) tk.mainloop()


Version: $Revision: 50704 $

Classes [hide private]
Event
Container for the properties of an event.
Variable
Class to define value holders for e.g.
StringVar
Value holder for strings variables.
IntVar
Value holder for integer variables.
DoubleVar
Value holder for float variables.
BooleanVar
Value holder for boolean variables.
Misc
Internal class.
CallWrapper
Internal class.
Wm
Provides functions for the communication with the window manager.
Tk
Toplevel widget of Tk which represents mostly the main window of an appliation.
Pack
Geometry manager Pack.
Place
Geometry manager Place.
Grid
Geometry manager Grid.
BaseWidget
Internal class.
Widget
Internal class.
Toplevel
Toplevel widget, e.g.
Button
Button widget.
Canvas
Canvas widget to display graphical elements like lines or text.
Checkbutton
Checkbutton widget which is either in on- or off-state.
Entry
Entry widget which allows to display simple text.
Frame
Frame widget which may contain other widgets and can have a 3D border.
Label
Label widget which can display text and bitmaps.
Listbox
Listbox widget which can display a list of strings.
Menu
Menu widget which allows to display menu bars, pull-down menus and pop-up menus.
Menubutton
Menubutton widget, obsolete since Tk8.0.
Message
Message widget to display multiline text.
Radiobutton
Radiobutton widget which shows only one of several buttons in on-state.
Scale
Scale widget which can display a numerical scale.
Scrollbar
Scrollbar widget which displays a slider at a certain position.
Text
Text widget which can display text in various forms.
_setit
Internal class.
OptionMenu
OptionMenu which allows the user to select a value from a menu.
Image
Base class for images.
PhotoImage
Widget which can display colored images in GIF, PPM/PGM format.
BitmapImage
Widget which can display a bitmap.
Spinbox
spinbox widget.
LabelFrame
labelframe widget.
PanedWindow
panedwindow widget.
Studbutton
Tributton
Functions [hide private]
 
_cnfmerge(cnfs)
Internal function.
 
NoDefaultRoot()
Inhibit setting of default root window.
 
_tkerror(err)
Internal function.
 
_exit(code='0')
Internal function.
 
mainloop(n=0)
Run the main loop of Tcl.
 
getboolean(s)
Convert true and false to integer values 1 and 0.
 
Tcl(screenName=None, baseName=None, className='Tk', useTk=0)
 
AtEnd()
 
AtInsert(*args)
 
AtSelFirst()
 
AtSelLast()
 
At(x, y=None)
 
image_names()
 
image_types()
 
_test()
Variables [hide private]
  _MacOS = None
  wantobjects = 1
  TkVersion = 8.4
  TclVersion = 8.4
  READABLE = 2
  WRITABLE = 4
  EXCEPTION = 8
  _support_default_root = 1
  _default_root = None
  _varnum = 0

Imports: sys, FixTk, _tkinter, tkinter, TclError, IntType, TypeType, BooleanType, CodeType, UnboundMethodType, StringType, BuiltinMethodType, FloatType, DictionaryType, NotImplementedType, BuiltinFunctionType, DictProxyType, GeneratorType, InstanceType, ObjectType, DictType, GetSetDescriptorType, FileType, EllipsisType, StringTypes, ListType, MethodType, TupleType, ModuleType, FrameType, LongType, BufferType, TracebackType, ClassType, MemberDescriptorType, UnicodeType, SliceType, ComplexType, LambdaType, FunctionType, XRangeType, NoneType, BEVEL, SEL_LAST, MULTIPLE, NORMAL, RIDGE, TOP, BUTT, DOTBOX, CHAR, ACTIVE, OUTSIDE, PAGES, SEPARATOR, NSEW, OFF, HORIZONTAL, TRUE, ROUND, BOTH, NONE, WORD, CENTER, SUNKEN, NO, BROWSE, NE, NUMERIC, CHECKBUTTON, FIRST, PIESLICE, PROJECTING, NS, LAST, ANCHOR, NW, FLAT, RAISED, EXTENDED, E, VERTICAL, INSERT, SOLID, SEL, MITER, MOVETO, N, CURRENT, CASCADE, S, CHORD, END, UNDERLINE, W, Y, X, EW, DISABLED, HIDDEN, BASELINE, UNITS, ON, ALL, RIGHT, FALSE, INSIDE, BOTTOM, SW, SEL_FIRST, SINGLE, RADIOBUTTON, ARC, COMMAND, YES, LEFT, GROOVE, SCROLL, SE, _flatten, getint, getdouble


Function Details [hide private]

NoDefaultRoot()

 

Inhibit setting of default root window.

Call this function to inhibit that the first instance of Tk is used for windows without an explicit parent window.

_exit(code='0')

 

Internal function. Calling it will throw the exception SystemExit.