UML diagrams for Python
Lumpy generates UML diagrams (currently object and class diagrams) from a running Python program. It is similar to a graphical debugger in the sense that it generates a visualization of the state of a running program, but it is different from a debugger in the sense that it tries to generate high-level visualizations that are compliant (at least in spirit) with standard UML.
There are three target audiences for this module: teachers, students and software engineers. Teachers can use Lumpy to generate figures that demonstrate a model of the execution of a Python program. Students can use Lumpy to explore the behavior of the Python interpreter. Software engineers can use Lumpy to extract the structure of existing programs by diagramming the relationships among the classes, including classes defined in libraries and the Python interpreter.
Copyright 2005 Allen B. Downey
This file contains wrapper classes I use with tkinter. It is mostly for my own use; I don’t support it, and it is not very well documented.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/gpl.html or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Bases: scitools.Lumpy.Thing
the graphical representation of the binding between a key and a value.
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
draw_key(diag, p, flip, tags) | draw a reference to a previously-drawn key rather |
drawme(diag, pos, flip[, tags]) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
rebind(val) | |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools.Lumpy.Instance
a graphical representation of a Class. It inherits from Instance, which controls how a Class appears in an object diagram, and contains a ClassDiagramClass, which controls how the Class appears in a class diagram.
Methods
add_child(child) | when a subclass is created, it notifies its parent |
add_hasa(child[, n]) | increment the number of references we have found |
add_ivar(var) | add to the set of instance variables for this class |
bbox() | the bbox of a Mapping is the bbox of its box item. |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | drawme is the middle part of the way objects are drawn. |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
scan_bindings(cls) | scan the bindings in this Instance, looking for |
scan_val(cls, val) | if we find a reference to an object type, make a note |
set_depth() | compute the maximum depth between this class and |
set_height() | compute the maximum height between this class and |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
when a subclass is created, it notifies its parent classes, who update their list of children
increment the number of references we have found from this class to the given child class
Bases: scitools.Lumpy.Diagram
Methods
add_arrow(arrow) | append a new arrow on the list |
ca(*args, **options) | make a canvas for the diagram |
close() | close the window and exit |
draw() | draw the class diagram, including the classes in self.classes, |
draw_arrows() | draw all the arrows on the list |
draw_classes(classes, pos[, tags]) | draw this list of classes and all their subclasses, |
printfile() | dump the contents of the canvas to the filename in the |
setup() | create the gui for the diagram |
update_arrows([n]) | update up to n arrows (or all of them is n==None) |
Bases: scitools.Lumpy.Thing
a graphical representation of a Class as it appears in a Class Diagram (which is different from the way class objects appear in Object Diagrams).
Methods
arrow_head(diag, bbox, tags[, size]) | draw the hollow arrow head that connects this class |
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools.Lumpy.Thing
a contains arrow, which shows a has-a relationship between classes in a class diagram.
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
update() |
Bases: scitools._Gui.GuiCanvas
a Canvas for displaying Diagrams
Methods
add_transform(transform[, index]) | add the given transform at the given index in the |
addtag(*args) | Internal function. |
addtag_above(newtag, tagOrId) | Add tag NEWTAG to all items above TAGORID. |
addtag_all(newtag) | Add tag NEWTAG to all items. |
addtag_below(newtag, tagOrId) | Add tag NEWTAG to all items below TAGORID. |
addtag_closest(newtag, x, y[, halo, start]) | Add tag NEWTAG to item which is closest to pixel at X, Y. |
addtag_enclosed(newtag, x1, y1, x2, y2) | Add tag NEWTAG to all items in the rectangle defined |
addtag_overlapping(newtag, x1, y1, x2, y2) | Add tag NEWTAG to all items which overlap the rectangle |
addtag_withtag(newtag, tagOrId) | Add tag NEWTAG to all items with TAGORID. |
after(ms[, func]) | Call function once after given time. |
after_cancel(id) | Cancel scheduling of function identified with ID. |
after_idle(func, *args) | Call FUNC once if the Tcl main loop has no event to |
arrow(start, end, **options) | draw an arrow: start and end can be a Pos object or |
bbox(item) | compute the bounding box of the given item |
bell([displayof]) | Ring a display’s bell. |
bind([sequence, func, add]) | Bind to this widget at event SEQUENCE a call to function FUNC. |
bind_all([sequence, func, add]) | Bind to all widgets at an event SEQUENCE a call to function FUNC. |
bind_class(className[, sequence, func, add]) | Bind to widgets with bindtag CLASSNAME at event |
bindtags([tagList]) | Set or get the list of bindtags for this widget. |
box(box[, padx, pady]) | draw a rectangle with the given bounding box, expanded |
canvasx(screenx[, gridspacing]) | Return the canvas x coordinate of pixel position SCREENX rounded |
canvasy(screeny[, gridspacing]) | Return the canvas y coordinate of pixel position SCREENY rounded |
cget(key) | Return the resource value for a KEY given as string. |
circle(x, y, r[, fill]) | make a circle with center at (x, y) and radius (r) |
clipboard_append(string, **kw) | Append STRING to the Tk clipboard. |
clipboard_clear(**kw) | Clear the data in the Tk clipboard. |
clipboard_get(**kw) | Retrieve data from the clipboard on window’s display. |
colormodel([value]) | Useless. |
columnconfigure(index[, cnf]) | Configure column INDEX of a grid. |
config([cnf]) | Configure resources of a widget. |
configure([cnf]) | Configure resources of a widget. |
coords(*args) | Return a list of coordinates for the item given in ARGS. |
create_arc(*args, **kw) | Create arc shaped region with coordinates x1,y1,x2,y2. |
create_bitmap(*args, **kw) | Create bitmap with coordinates x1,y1. |
create_image(*args, **kw) | Create image item with coordinates x1,y1. |
create_line(*args, **kw) | Create line with coordinates x1,y1,...,xn,yn. |
create_oval(*args, **kw) | Create oval with coordinates x1,y1,x2,y2. |
create_polygon(*args, **kw) | Create polygon with coordinates x1,y1,...,xn,yn. |
create_rectangle(*args, **kw) | Create rectangle with coordinates x1,y1,x2,y2. |
create_text(*args, **kw) | Create text with coordinates x1,y1. |
create_window(*args, **kw) | Create window with coordinates x1,y1,x2,y2. |
dchars(*args) | Delete characters of text items identified by tag or id in ARGS (possibly |
delete(*args) | Delete items identified by all tag or ids contained in ARGS. |
deletecommand(name) | Internal function. |
destroy() | Destroy this and all descendants widgets. |
dot(pos[, r]) | draw a dot at the given position with radius r |
dtag(*args) | Delete tag or id given as last arguments in ARGS from items |
dump([filename]) | create a PostScipt file with the given name and dump |
event_add(virtual, *sequences) | Bind a virtual event VIRTUAL (of the form <<Name>>) |
event_delete(virtual, *sequences) | Unbind a virtual event VIRTUAL from SEQUENCE. |
event_generate(sequence, **kw) | Generate an event SEQUENCE. Additional |
event_info([virtual]) | Return a list of all virtual events or the information |
find(*args) | Internal function. |
find_above(tagOrId) | Return items above TAGORID. |
find_all() | Return all items. |
find_below(tagOrId) | Return all items below TAGORID. |
find_closest(x, y[, halo, start]) | Return item which is closest to pixel at X, Y. |
find_enclosed(x1, y1, x2, y2) | Return all items in rectangle defined |
find_overlapping(x1, y1, x2, y2) | Return all items which overlap the rectangle |
find_withtag(tagOrId) | Return all items with TAGORID. |
flipx(item) | warning: this works in pixel coordinates |
focus(*args) | Set focus to the first item specified in ARGS. |
focus_displayof() | Return the widget which has currently the focus on the display where this widget is located. |
focus_force() | Direct input focus to this widget even if the application does not have the focus. |
focus_get() | Return the widget which has currently the focus in the application. |
focus_lastfor() | Return the widget which would have the focus if top level |
focus_set() | Direct input focus to this widget. |
forget() | Unmap this widget and do not use it for the packing order. |
getboolean(s) | Return a boolean value for Tcl boolean values true and false given as parameter. |
getdouble | |
getint | |
gettags(*args) | Return tags associated with the first item specified in ARGS. |
getvar([name]) | Return value of Tcl variable NAME. |
grab_current() | Return widget which has currently the grab in this application |
grab_release() | Release grab for this widget if currently set. |
grab_set() | Set grab for this widget. |
grab_set_global() | Set global grab for this widget. |
grab_status() | Return None, “local” or “global” if this widget has |
grid([cnf]) | Position a widget in the parent widget in a grid. |
grid_bbox([column, row, col2, row2]) | Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid. |
grid_columnconfigure(index[, cnf]) | Configure column INDEX of a grid. |
grid_configure([cnf]) | Position a widget in the parent widget in a grid. |
grid_forget() | Unmap this widget. |
grid_info() | Return information about the options |
grid_location(x, y) | Return a tuple of column and row which identify the cell |
grid_propagate([flag]) | Set or get the status for propagation of geometry information. |
grid_remove() | Unmap this widget but remember the grid options. |
grid_rowconfigure(index[, cnf]) | Configure row INDEX of a grid. |
grid_size() | Return a tuple of the number of column and rows in the grid. |
grid_slaves([row, column]) | Return a list of all slaves of this widget |
icursor(*args) | Set cursor at position POS in the item identified by TAGORID. |
image(coord, image, **options) | make an image item with the given image at the given position. |
image_names() | Return a list of all existing image names. |
image_types() | Return a list of all available image types (e.g. |
index(*args) | Return position of cursor as integer in item specified in ARGS. |
info() | Return information about the packing options |
insert(*args) | Insert TEXT in item TAGORID at position POS. ARGS must |
invert(coords) | apply the inverse of each of the transforms, in reverse |
itemcget(tagOrId, option) | Return the resource value for an OPTION for item TAGORID. |
itemconfig(tagOrId[, cnf]) | Configure resources of an item TAGORID. |
itemconfigure(tagOrId[, cnf]) | Configure resources of an item TAGORID. |
keys() | Return a list of all resource names of this widget. |
lift(*args) | Raise an item TAGORID given in ARGS |
line(coords[, fill]) | make a polyline with vertices at each point in (coords) |
location(x, y) | Return a tuple of column and row which identify the cell |
lower(*args) | Lower an item TAGORID given in ARGS |
mainloop([n]) | Call the mainloop of Tk. |
measure(t, **options) | find the bounding box of the list of words by |
move(*args) | Move an item TAGORID given in ARGS. |
nametowidget(name) | Return the Tkinter instance of a widget identified by |
option_add(pattern, value[, priority]) | Set a VALUE (second parameter) for an option |
option_clear() | Clear the option database. |
option_get(name, className) | Return the value for an option NAME for this widget |
option_readfile(fileName[, priority]) | Read file FILENAME into the option database. |
oval(coords[, fill]) | make an oval with bounding box (coords) and fill color (fill) |
pack([cnf]) | Pack a widget in the parent widget. |
pack_configure([cnf]) | Pack a widget in the parent widget. |
pack_forget() | Unmap this widget and do not use it for the packing order. |
pack_info() | Return information about the packing options |
pack_propagate([flag]) | Set or get the status for propagation of geometry information. |
pack_slaves() | Return a list of all slaves of this widget |
place([cnf]) | Place a widget in the parent widget. |
place_configure([cnf]) | Place a widget in the parent widget. |
place_forget() | Unmap this widget. |
place_info() | Return information about the placing options |
place_slaves() | Return a list of all slaves of this widget |
polygon(coords[, fill]) | make a close polygon with vertices at each point in (coords) |
postscript([cnf]) | Print the contents of the canvas to a postscript file. |
propagate([flag]) | Set or get the status for propagation of geometry information. |
quit() | Quit the Tcl interpreter. All widgets will be destroyed. |
rectangle(coords[, fill]) | make an oval with bounding box (coords) and fill color (fill) |
register(func[, subst, needcleanup]) | Return a newly created Tcl function. If this |
rowconfigure(index[, cnf]) | Configure row INDEX of a grid. |
scale(*args) | Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE. |
scan_dragto(x, y[, gain]) | Adjust the view of the canvas to GAIN times the |
scan_mark(x, y) | Remember the current X, Y coordinates. |
select_adjust(tagOrId, index) | Adjust the end of the selection near the cursor of an item TAGORID to index. |
select_clear() | Clear the selection if it is in this widget. |
select_from(tagOrId, index) | Set the fixed end of a selection in item TAGORID to INDEX. |
select_item() | Return the item which has the selection. |
select_to(tagOrId, index) | Set the variable end of a selection in item TAGORID to INDEX. |
selection_clear(**kw) | Clear the current X selection. |
selection_get(**kw) | Return the contents of the current X selection. |
selection_handle(command, **kw) | Specify a function COMMAND to call if the X |
selection_own(**kw) | Become owner of X selection. |
selection_own_get(**kw) | Return owner of X selection. |
send(interp, cmd, *args) | Send Tcl command CMD to different interpreter INTERP to be executed. |
setvar([name, value]) | Set Tcl variable NAME to VALUE. |
size() | Return a tuple of the number of column and rows in the grid. |
slaves() | Return a list of all slaves of this widget |
str(pos, text[, dx, dy]) | draw the given text at the given position, with an offset |
tag_bind(tagOrId[, sequence, func, add]) | Bind to all items with TAGORID at event SEQUENCE a call to function FUNC. |
tag_lower(*args) | Lower an item TAGORID given in ARGS |
tag_raise(*args) | Raise an item TAGORID given in ARGS |
tag_unbind(tagOrId, sequence[, funcid]) | Unbind for all items with TAGORID for event SEQUENCE the |
tcoords(item[, coords]) | provides get and set access to item coordinates, |
text(coord[, text, fill]) | make a text item with the given text and fill color. |
tk_bisque() | Change the color scheme to light brown as used in Tk 3.6 and before. |
tk_focusFollowsMouse() | The widget under mouse will get automatically focus. |
tk_focusNext() | Return the next widget in the focus order which follows widget which has currently the focus. |
tk_focusPrev() | Return previous widget in the focus order. |
tk_menuBar(*args) | Do not use. |
tk_setPalette(*args, **kw) | Set a new color scheme for all widget elements. |
tk_strictMotif([boolean]) | Set Tcl internal variable, whether the look and feel |
tkraise(*args) | Raise an item TAGORID given in ARGS |
tmove(tags[, dx, dy]) | move all items with the given tags, with dx and dy |
trans(coords) | apply each of the transforms for this canvas, in order. |
type(tagOrId) | Return the type of the item TAGORID. |
unbind(sequence[, funcid]) | Unbind for this widget for event SEQUENCE the |
unbind_all(sequence) | Unbind for all widgets for event SEQUENCE all functions. |
unbind_class(className, sequence) | Unbind for a all widgets with bindtag CLASSNAME for event SEQUENCE |
update() | Enter event loop until all pending events have been processed by Tcl. |
update_idletasks() | Enter event loop until all idle callbacks have been called. |
wait_variable([name]) | Wait until the variable is modified. |
wait_visibility([window]) | Wait until the visibility of a WIDGET changes |
wait_window([window]) | Wait until a WIDGET is destroyed. |
waitvar([name]) | Wait until the variable is modified. |
winfo_atom(name[, displayof]) | Return integer which represents atom NAME. |
winfo_atomname(id[, displayof]) | Return name of atom with identifier ID. |
winfo_cells() | Return number of cells in the colormap for this widget. |
winfo_children() | Return a list of all widgets which are children of this widget. |
winfo_class() | Return window class name of this widget. |
winfo_colormapfull() | Return true if at the last color request the colormap was full. |
winfo_containing(rootX, rootY[, displayof]) | Return the widget which is at the root coordinates ROOTX, ROOTY. |
winfo_depth() | Return the number of bits per pixel. |
winfo_exists() | Return true if this widget exists. |
winfo_fpixels(number) | Return the number of pixels for the given distance NUMBER |
winfo_geometry() | Return geometry string for this widget in the form “widthxheight+X+Y”. |
winfo_height() | Return height of this widget. |
winfo_id() | Return identifier ID for this widget. |
winfo_interps([displayof]) | Return the name of all Tcl interpreters for this display. |
winfo_ismapped() | Return true if this widget is mapped. |
winfo_manager() | Return the window mananger name for this widget. |
winfo_name() | Return the name of this widget. |
winfo_parent() | Return the name of the parent of this widget. |
winfo_pathname(id[, displayof]) | Return the pathname of the widget given by ID. |
winfo_pixels(number) | Rounded integer value of winfo_fpixels. |
winfo_pointerx() | Return the x coordinate of the pointer on the root window. |
winfo_pointerxy() | Return a tuple of x and y coordinates of the pointer on the root window. |
winfo_pointery() | Return the y coordinate of the pointer on the root window. |
winfo_reqheight() | Return requested height of this widget. |
winfo_reqwidth() | Return requested width of this widget. |
winfo_rgb(color) | Return tuple of decimal values for red, green, blue for |
winfo_rootx() | Return x coordinate of upper left corner of this widget on the |
winfo_rooty() | Return y coordinate of upper left corner of this widget on the |
winfo_screen() | Return the screen name of this widget. |
winfo_screencells() | Return the number of the cells in the colormap of the screen |
winfo_screendepth() | Return the number of bits per pixel of the root window of the |
winfo_screenheight() | Return the number of pixels of the height of the screen of this widget |
winfo_screenmmheight() | Return the number of pixels of the height of the screen of |
winfo_screenmmwidth() | Return the number of pixels of the width of the screen of |
winfo_screenvisual() | Return one of the strings directcolor, grayscale, pseudocolor, |
winfo_screenwidth() | Return the number of pixels of the width of the screen of |
winfo_server() | Return information of the X-Server of the screen of this widget in |
winfo_toplevel() | Return the toplevel widget of this widget. |
winfo_viewable() | Return true if the widget and all its higher ancestors are mapped. |
winfo_visual() | Return one of the strings directcolor, grayscale, pseudocolor, |
winfo_visualid() | Return the X identifier for the visual for this widget. |
winfo_visualsavailable([includeids]) | Return a list of all visuals available for the screen of this widget. |
winfo_vrootheight() | Return the height of the virtual root window associated with this widget in pixels. |
winfo_vrootwidth() | Return the width of the virtual root window associated with this widget in pixel. |
winfo_vrootx() | Return the x offset of the virtual root relative to the root |
winfo_vrooty() | Return the y offset of the virtual root relative to the root |
winfo_width() | Return the width of this widget. |
winfo_x() | Return the x coordinate of the upper left corner of this widget |
winfo_y() | Return the y coordinate of the upper left corner of this widget |
xview(*args) | Query and change the horizontal position of the view. |
xview_moveto(fraction) | Adjusts the view in the window so that FRACTION of the |
xview_scroll(number, what) | Shift the x-view according to NUMBER which is measured in “units” |
yview(*args) | Query and change the vertical position of the view. |
yview_moveto(fraction) | Adjusts the view in the window so that FRACTION of the |
yview_scroll(number, what) | Shift the y-view according to NUMBER which is measured in |
draw an arrow: start and end can be a Pos object or a list of two coordinates
draw a rectangle with the given bounding box, expanded by padx and pady. box can be a Bbox object or a list of two coordinate pairs.
Bases: object
the parent class for ClassDiagram and ObjectDiagram.
Methods
add_arrow(arrow) | append a new arrow on the list |
ca(*args, **options) | make a canvas for the diagram |
close() | close the window and exit |
draw_arrows() | draw all the arrows on the list |
printfile() | dump the contents of the canvas to the filename in the |
setup() | create the gui for the diagram |
update_arrows([n]) | update up to n arrows (or all of them is n==None) |
Bases: scitools.Lumpy.Thing
the Thing that represents a dot in a diagram
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools.Lumpy.Mapping
The graphical representation of a frame, implemented as a list of Bindings
Methods
bbox() | the bbox of a Mapping is the bbox of its box item. |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | drawme is the middle part of the way objects are drawn. |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
scan_bindings(cls) | scan the bindings in this mapping, looking for |
scan_val(cls, val) | if we find a reference to an object type, make a note |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools.Lumpy.Simple
the graphical representation of an index in a Sequence. An Index object does not register with lumpy, so that even in pedantic mode, it is always drawn, and it is never the target of a reference (since it is not really a value at run-time).
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools.Lumpy.Mapping
The graphical representation of an object (usually). Anything with a __dict__ is treated as an Instance.
Methods
bbox() | the bbox of a Mapping is the bbox of its box item. |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | drawme is the middle part of the way objects are drawn. |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
scan_bindings(cls) | scan the bindings in this Instance, looking for |
scan_val(cls, val) | if we find a reference to an object type, make a note |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools._Gui.Gui
the Lumpy object represents the GUI window.
Methods
ScrollableCanvas | |
ScrollableText | |
after(ms[, func]) | Call function once after given time. |
after_cancel(id) | Cancel scheduling of function identified with ID. |
after_idle(func, *args) | Call FUNC once if the Tcl main loop has no event to |
aspect([minNumer, minDenom, maxNumer, maxDenom]) | Instruct the window manager to set the aspect ratio (width/height) |
attributes(*args) | This subcommand returns or sets platform specific attributes |
bbox([column, row, col2, row2]) | Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid. |
bell([displayof]) | Ring a display’s bell. |
bind([sequence, func, add]) | Bind to this widget at event SEQUENCE a call to function FUNC. |
bind_all([sequence, func, add]) | Bind to all widgets at an event SEQUENCE a call to function FUNC. |
bind_class(className[, sequence, func, add]) | Bind to widgets with bindtag CLASSNAME at event |
bindtags([tagList]) | Set or get the list of bindtags for this widget. |
bu(*args, **options) | make a button |
ca(*args, **options) | make a canvas widget. |
cb(*args, **options) | make a checkbutton. |
cget(key) | Return the resource value for a KEY given as string. |
class_diagram([classes]) | create a new object diagram based on the current state. |
client([name]) | Store NAME in WM_CLIENT_MACHINE property of this widget. Return |
clipboard_append(string, **kw) | Append STRING to the Tk clipboard. |
clipboard_clear(**kw) | Clear the data in the Tk clipboard. |
clipboard_get(**kw) | Retrieve data from the clipboard on window’s display. |
colormapwindows(*wlist) | Store list of window names (WLIST) into WM_COLORMAPWINDOWS property |
colormodel([value]) | Useless. |
columnconfigure(index[, cnf]) | Configure column INDEX of a grid. |
colweights(weights) | attach weights to the columns of the current grid. |
command([value]) | Store VALUE in WM_COMMAND property. It is the command |
config([cnf]) | Configure resources of a widget. |
configure([cnf]) | Configure resources of a widget. |
deiconify() | Deiconify this widget. |
deletecommand(name) | Internal function. |
destroy() | Destroy this and all descendants widgets. |
en(*args, **options) | make an entry widget. |
endfr() | end the current frame (and return it) |
endgr() | end the current frame (and return it) |
event_add(virtual, *sequences) | Bind a virtual event VIRTUAL (of the form <<Name>>) |
event_delete(virtual, *sequences) | Unbind a virtual event VIRTUAL from SEQUENCE. |
event_generate(sequence, **kw) | Generate an event SEQUENCE. Additional |
event_info([virtual]) | Return a list of all virtual events or the information |
focus() | Direct input focus to this widget. |
focus_displayof() | Return the widget which has currently the focus on the display where this widget is located. |
focus_force() | Direct input focus to this widget even if the application does not have the focus. |
focus_get() | Return the widget which has currently the focus in the application. |
focus_lastfor() | Return the widget which would have the focus if top level |
focus_set() | Direct input focus to this widget. |
focusmodel([model]) | Set focus model to MODEL. “active” means that this widget will claim |
fr(*args, **options) | make a return a frame. |
geometry([newGeometry]) | Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return |
get_class_list() | return the list of classes that should be drawn in |
getboolean(s) | Return a boolean value for Tcl boolean values true and false given as parameter. |
getdouble | |
getint | |
getvar([name]) | Return value of Tcl variable NAME. |
gr(cols[, cweights, rweights]) | create a frame and switch to grid mode. |
grab_current() | Return widget which has currently the grab in this application |
grab_release() | Release grab for this widget if currently set. |
grab_set() | Set grab for this widget. |
grab_set_global() | Set global grab for this widget. |
grab_status() | Return None, “local” or “global” if this widget has |
grid(widget[, i, j]) | pack the given widget in the current grid. |
grid_bbox([column, row, col2, row2]) | Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid. |
grid_columnconfigure(index[, cnf]) | Configure column INDEX of a grid. |
grid_location(x, y) | Return a tuple of column and row which identify the cell |
grid_propagate([flag]) | Set or get the status for propagation of geometry information. |
grid_rowconfigure(index[, cnf]) | Configure row INDEX of a grid. |
grid_size() | Return a tuple of the number of column and rows in the grid. |
grid_slaves([row, column]) | Return a list of all slaves of this widget |
group([pathName]) | Set the group leader widgets for related widgets to PATHNAME. Return |
iconbitmap([bitmap, default]) | Set bitmap for the iconified widget to BITMAP. Return |
iconify() | Display widget as icon. |
iconmask([bitmap]) | Set mask for the icon bitmap of this widget. |
iconname([newName]) | Set the name of the icon for this widget. |
iconposition([x, y]) | Set the position of the icon of this widget to X and Y. Return |
iconwindow([pathName]) | Set widget PATHNAME to be displayed instead of icon. Return the current |
image_names() | Return a list of all existing image names. |
image_types() | Return a list of all available image types (e.g. |
is_opaque(classobj) | check whether this class is completely opaque |
keys() | Return a list of all resource names of this widget. |
la(*args, **options) | make a label widget. |
lb(*args, **options) | make a listbox. |
lift([aboveThis]) | Raise this widget in the stacking order. |
loadtk() | |
lookup(val) | check to see whether the given value is already represented |
lower([belowThis]) | Lower this widget in the stacking order. |
mainloop([n]) | Call the mainloop of Tk. |
make_reference() | make a reference point by taking a snapshot of the current |
make_reference2() | this extra method call is here so that the reference |
make_stack() | take a snapshot of the current state, subtract away the |
maxsize([width, height]) | Set max WIDTH and HEIGHT for this widget. If the window is gridded |
mb(*args, **options) | make a menubutton |
mi(mb[, label]) | make a menu item |
minsize([width, height]) | Set min WIDTH and HEIGHT for this widget. If the window is gridded |
nametowidget(name) | Return the Tkinter instance of a widget identified by |
object_diagram([obj]) | create a new object diagram based on the current state. |
opaque_class(classobj) | restrict this class to no variables |
opaque_module(modobj) | make all classes defined in this module opaque |
option_add(pattern, value[, priority]) | Set a VALUE (second parameter) for an option |
option_clear() | Clear the option database. |
option_get(name, className) | Return the value for an option NAME for this widget |
option_readfile(fileName[, priority]) | Read file FILENAME into the option database. |
overrideredirect([boolean]) | Instruct the window manager to ignore this widget |
pack_propagate([flag]) | Set or get the status for propagation of geometry information. |
pack_slaves() | Return a list of all slaves of this widget |
place_slaves() | Return a list of all slaves of this widget |
popfr() | end the current frame (and return it) |
positionfrom([who]) | Instruct the window manager that the position of this widget shall |
propagate([flag]) | Set or get the status for propagation of geometry information. |
protocol([name, func]) | Bind function FUNC to command NAME for this widget. |
pushfr(frame) | push a frame onto the frame stack |
quit() | Quit the Tcl interpreter. All widgets will be destroyed. |
rb(*args, **options) | make a radiobutton |
readprofile(baseName, className) | Internal function. |
register(thing, val) | associate a value with the Thing that represents it, |
report_callback_exception(exc, val, tb) | Internal function. |
resizable([width, height]) | Instruct the window manager whether this width can be resized |
restrict_class(classobj[, vars]) | restrict this class so that when it is drawn, only |
rowconfigure(index[, cnf]) | Configure row INDEX of a grid. |
rowweights(weights) | attach weights to the rows of the current grid. |
sb(*args, **options) | make a text scrollbar |
sc(*args, **options) | make a scrollable canvas. |
selection_clear(**kw) | Clear the current X selection. |
selection_get(**kw) | Return the contents of the current X selection. |
selection_handle(command, **kw) | Specify a function COMMAND to call if the X |
selection_own(**kw) | Become owner of X selection. |
selection_own_get(**kw) | Return owner of X selection. |
send(interp, cmd, *args) | Send Tcl command CMD to different interpreter INTERP to be executed. |
setvar([name, value]) | Set Tcl variable NAME to VALUE. |
size() | Return a tuple of the number of column and rows in the grid. |
sizefrom([who]) | Instruct the window manager that the size of this widget shall |
slaves() | Return a list of all slaves of this widget |
st(*args, **options) | make a scrollable text entry |
state([newstate]) | Query or set the state of this widget as one of normal, icon, |
te(*args, **options) | make a text entry |
title([string]) | Set the title of this widget. |
tk_bisque() | Change the color scheme to light brown as used in Tk 3.6 and before. |
tk_focusFollowsMouse() | The widget under mouse will get automatically focus. |
tk_focusNext() | Return the next widget in the focus order which follows widget which has currently the focus. |
tk_focusPrev() | Return previous widget in the focus order. |
tk_menuBar(*args) | Do not use. |
tk_setPalette(*args, **kw) | Set a new color scheme for all widget elements. |
tk_strictMotif([boolean]) | Set Tcl internal variable, whether the look and feel |
tkraise([aboveThis]) | Raise this widget in the stacking order. |
tl(**options) | make a return a top level window. |
transient([master]) | Instruct the window manager that this widget is transient |
transparent_class(classobj) | remove the given type or class from the dictionary, which |
unbind(sequence[, funcid]) | Unbind for this widget for event SEQUENCE the |
unbind_all(sequence) | Unbind for all widgets for event SEQUENCE all functions. |
unbind_class(className, sequence) | Unbind for a all widgets with bindtag CLASSNAME for event SEQUENCE |
update() | Enter event loop until all pending events have been processed by Tcl. |
update_idletasks() | Enter event loop until all idle callbacks have been called. |
wait_variable([name]) | Wait until the variable is modified. |
wait_visibility([window]) | Wait until the visibility of a WIDGET changes |
wait_window([window]) | Wait until a WIDGET is destroyed. |
waitvar([name]) | Wait until the variable is modified. |
widget(constructor, *args, **options) | this is the kernel of the widget constructors. |
winfo_atom(name[, displayof]) | Return integer which represents atom NAME. |
winfo_atomname(id[, displayof]) | Return name of atom with identifier ID. |
winfo_cells() | Return number of cells in the colormap for this widget. |
winfo_children() | Return a list of all widgets which are children of this widget. |
winfo_class() | Return window class name of this widget. |
winfo_colormapfull() | Return true if at the last color request the colormap was full. |
winfo_containing(rootX, rootY[, displayof]) | Return the widget which is at the root coordinates ROOTX, ROOTY. |
winfo_depth() | Return the number of bits per pixel. |
winfo_exists() | Return true if this widget exists. |
winfo_fpixels(number) | Return the number of pixels for the given distance NUMBER |
winfo_geometry() | Return geometry string for this widget in the form “widthxheight+X+Y”. |
winfo_height() | Return height of this widget. |
winfo_id() | Return identifier ID for this widget. |
winfo_interps([displayof]) | Return the name of all Tcl interpreters for this display. |
winfo_ismapped() | Return true if this widget is mapped. |
winfo_manager() | Return the window mananger name for this widget. |
winfo_name() | Return the name of this widget. |
winfo_parent() | Return the name of the parent of this widget. |
winfo_pathname(id[, displayof]) | Return the pathname of the widget given by ID. |
winfo_pixels(number) | Rounded integer value of winfo_fpixels. |
winfo_pointerx() | Return the x coordinate of the pointer on the root window. |
winfo_pointerxy() | Return a tuple of x and y coordinates of the pointer on the root window. |
winfo_pointery() | Return the y coordinate of the pointer on the root window. |
winfo_reqheight() | Return requested height of this widget. |
winfo_reqwidth() | Return requested width of this widget. |
winfo_rgb(color) | Return tuple of decimal values for red, green, blue for |
winfo_rootx() | Return x coordinate of upper left corner of this widget on the |
winfo_rooty() | Return y coordinate of upper left corner of this widget on the |
winfo_screen() | Return the screen name of this widget. |
winfo_screencells() | Return the number of the cells in the colormap of the screen |
winfo_screendepth() | Return the number of bits per pixel of the root window of the |
winfo_screenheight() | Return the number of pixels of the height of the screen of this widget |
winfo_screenmmheight() | Return the number of pixels of the height of the screen of |
winfo_screenmmwidth() | Return the number of pixels of the width of the screen of |
winfo_screenvisual() | Return one of the strings directcolor, grayscale, pseudocolor, |
winfo_screenwidth() | Return the number of pixels of the width of the screen of |
winfo_server() | Return information of the X-Server of the screen of this widget in |
winfo_toplevel() | Return the toplevel widget of this widget. |
winfo_viewable() | Return true if the widget and all its higher ancestors are mapped. |
winfo_visual() | Return one of the strings directcolor, grayscale, pseudocolor, |
winfo_visualid() | Return the X identifier for the visual for this widget. |
winfo_visualsavailable([includeids]) | Return a list of all visuals available for the screen of this widget. |
winfo_vrootheight() | Return the height of the virtual root window associated with this widget in pixels. |
winfo_vrootwidth() | Return the width of the virtual root window associated with this widget in pixel. |
winfo_vrootx() | Return the x offset of the virtual root relative to the root |
winfo_vrooty() | Return the y offset of the virtual root relative to the root |
winfo_width() | Return the width of this widget. |
winfo_x() | Return the x coordinate of the upper left corner of this widget |
winfo_y() | Return the y coordinate of the upper left corner of this widget |
withdraw() | Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. |
wm_aspect([minNumer, minDenom, maxNumer, ...]) | Instruct the window manager to set the aspect ratio (width/height) |
wm_attributes(*args) | This subcommand returns or sets platform specific attributes |
wm_client([name]) | Store NAME in WM_CLIENT_MACHINE property of this widget. Return |
wm_colormapwindows(*wlist) | Store list of window names (WLIST) into WM_COLORMAPWINDOWS property |
wm_command([value]) | Store VALUE in WM_COMMAND property. It is the command |
wm_deiconify() | Deiconify this widget. |
wm_focusmodel([model]) | Set focus model to MODEL. “active” means that this widget will claim |
wm_frame() | Return identifier for decorative frame of this widget if present. |
wm_geometry([newGeometry]) | Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return |
wm_grid([baseWidth, baseHeight, widthInc, ...]) | Instruct the window manager that this widget shall only be resized on grid boundaries. |
wm_group([pathName]) | Set the group leader widgets for related widgets to PATHNAME. Return |
wm_iconbitmap([bitmap, default]) | Set bitmap for the iconified widget to BITMAP. Return |
wm_iconify() | Display widget as icon. |
wm_iconmask([bitmap]) | Set mask for the icon bitmap of this widget. |
wm_iconname([newName]) | Set the name of the icon for this widget. |
wm_iconposition([x, y]) | Set the position of the icon of this widget to X and Y. Return |
wm_iconwindow([pathName]) | Set widget PATHNAME to be displayed instead of icon. Return the current |
wm_maxsize([width, height]) | Set max WIDTH and HEIGHT for this widget. If the window is gridded |
wm_minsize([width, height]) | Set min WIDTH and HEIGHT for this widget. If the window is gridded |
wm_overrideredirect([boolean]) | Instruct the window manager to ignore this widget |
wm_positionfrom([who]) | Instruct the window manager that the position of this widget shall |
wm_protocol([name, func]) | Bind function FUNC to command NAME for this widget. |
wm_resizable([width, height]) | Instruct the window manager whether this width can be resized |
wm_sizefrom([who]) | Instruct the window manager that the size of this widget shall |
wm_state([newstate]) | Query or set the state of this widget as one of normal, icon, |
wm_title([string]) | Set the title of this widget. |
wm_transient([master]) | Instruct the window manager that this widget is transient |
wm_withdraw() | Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. |
create a new object diagram based on the current state. If a list of classes is provided, only those classes are shown. Otherwise, all classes that Lumpy know about are shown.
check whether this class is completely opaque (restricted to _no_ instance variables)
check to see whether the given value is already represented by a Thing, and if so, return it.
make a reference point by taking a snapshot of the current state. Subsequent diagrams will be relative to this reference.
this extra method call is here so that the reference and the snapshot we take later have the same number of frames on the stack. UGH.
take a snapshot of the current state, subtract away the frames and variables that existed in the previous reference, then make a Stack.
create a new object diagram based on the current state. If an object is provided, draw the object. Otherwise, draw the current run-time stack (relative to the last reference).
associate a value with the Thing that represents it, so that we can check later whether we have already created a Thing for a given value.
Bases: scitools.Lumpy.Thing
the graphical representation of a mapping type (usually a dictionary). Sequence and Instance inherit from Mapping.
Methods
bbox() | the bbox of a Mapping is the bbox of its box item. |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | drawme is the middle part of the way objects are drawn. |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
scan_bindings(cls) | scan the bindings in this mapping, looking for |
scan_val(cls, val) | if we find a reference to an object type, make a note |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
the bbox of a Mapping is the bbox of its box item. This is different from other Things.
drawme is the middle part of the way objects are drawn. Thing.draw does some prep work, invokes drawme, and then does some cleanup. draw and drawme are not allowed to modify pos.
Bases: scitools.Lumpy.Diagram
Methods
add_arrow(arrow) | append a new arrow on the list |
ca(*args, **options) | make a canvas for the diagram |
clear() | |
close() | close the window and exit |
draw(thing) | draw the given thing |
draw_arrows() | draw all the arrows on the list |
printfile() | dump the contents of the canvas to the filename in the |
setup() | create the gui for the diagram |
update_arrows([n]) | update up to n arrows (or all of them is n==None) |
update_snapshot(snapshot) |
Bases: scitools.Lumpy.Thing
an inheritance arrow, which shows an is-a relationship between classes in a class diagram.
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
update() |
Bases: scitools.Lumpy.Thing
a reference arrow, which show a reference in an object diagram
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
update() |
Bases: scitools.Lumpy.Mapping
the graphical representation of a sequence type (mostly lists and tuples)
Methods
bbox() | the bbox of a Mapping is the bbox of its box item. |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | drawme is the middle part of the way objects are drawn. |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
scan_bindings(cls) | scan the bindings in this mapping, looking for |
scan_val(cls, val) | if we find a reference to an object type, make a note |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: scitools.Lumpy.Thing
the graphical representation of a simple value like a number or a string
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: object
the data structure that represents a frame
Methods
subtract(other) | delete all the keys in other from self |
Bases: object
the data structure that represents a stack
Methods
clean(ref) | Remove all the variables in the reference stack from self |
spew() | print the frames in this snapshot |
Bases: scitools.Lumpy.Thing
The graphical representation of a stack.
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
drawme(diag, pos, flip[, tags]) | |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
Bases: object
the parent class for objects that have a graphical representation. Each Thing object corresponds to an item or set of items in a diagram. A Thing can only be drawn in one Diagram at a time.
Methods
bbox() | return the bounding box of this object if it is drawn |
bind([tags]) | create bindings for each of the items with the given tags |
down(event) | this callback is invoked when the user clicks on an item |
draw(diag, pos, flip[, tags]) | draw this Thing at the given position on the given |
isdrawn() | return True if the object has been drawn |
motion(event) | this callback is invoked when the user drags an item |
pos() | Compute the nominal position of a Thing by getting the |
set_offset(pos) | the offset attribute keeps track of the offset between |
up(event) | this callback is invoked when the user releases the button |
draw this Thing at the given position on the given diagram with the given tags (in addition to the specific tag for this thing). flip=1 means draw left to right; flip=-1 means right to left. Return a list of Things that were drawn.
draw and drawme are not allowed to mofify pos
Compute the nominal position of a Thing by getting the current bounding box and adding the offset.
the offset attribute keeps track of the offset between the bounding box of the Thing and its nominal position, so that if the Thing is moved later, we can compute its new nominal position.
return a list of bindings, one for each key-value pair in iterator. The keys are made into Index objects.
return a list of bindings, one for each key-value pair in iterator. The keys are made into Thing objects.
return a tuple with a single element: a tag string with with the given prefix and a unique id as a suffix