Module Tkinter :: Class Canvas
[hide private]
[frames] | no frames]

_ClassType Canvas

  Misc --+        
         |        
BaseWidget --+    
             |    
      Pack --+    
             |    
     Place --+    
             |    
      Grid --+    
             |    
  Tix.Form --+    
             |    
        Widget --+
                 |
                Canvas

Canvas widget to display graphical elements like lines or text.

Nested Classes [hide private]

Inherited from Misc: getdouble, getint

Instance Methods [hide private]
 
__init__(self, master=None, cnf={}, **kw)
Construct a canvas widget with the parent MASTER.
 
addtag(self, *args)
Internal function.
 
addtag_above(self, newtag, tagOrId)
Add tag NEWTAG to all items above TAGORID.
 
addtag_all(self, newtag)
Add tag NEWTAG to all items.
 
addtag_below(self, newtag, tagOrId)
Add tag NEWTAG to all items below TAGORID.
 
addtag_closest(self, newtag, x, y, halo=None, start=None)
Add tag NEWTAG to item which is closest to pixel at X, Y.
 
addtag_enclosed(self, newtag, x1, y1, x2, y2)
Add tag NEWTAG to all items in the rectangle defined by X1,Y1,X2,Y2.
 
addtag_overlapping(self, newtag, x1, y1, x2, y2)
Add tag NEWTAG to all items which overlap the rectangle defined by X1,Y1,X2,Y2.
 
addtag_withtag(self, newtag, tagOrId)
Add tag NEWTAG to all items with TAGORID.
 
bbox(self, *args)
Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle which encloses all items with tags specified as arguments.
 
tag_unbind(self, tagOrId, sequence, funcid=None)
Unbind for all items with TAGORID for event SEQUENCE the function identified with FUNCID.
 
tag_bind(self, tagOrId, sequence=None, func=None, add=None)
Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.
 
canvasx(self, screenx, gridspacing=None)
Return the canvas x coordinate of pixel position SCREENX rounded to nearest multiple of GRIDSPACING units.
 
canvasy(self, screeny, gridspacing=None)
Return the canvas y coordinate of pixel position SCREENY rounded to nearest multiple of GRIDSPACING units.
 
coords(self, *args)
Return a list of coordinates for the item given in ARGS.
 
_create(self, itemType, args, kw)
Internal function.
 
create_arc(self, *args, **kw)
Create arc shaped region with coordinates x1,y1,x2,y2.
 
create_bitmap(self, *args, **kw)
Create bitmap with coordinates x1,y1.
 
create_image(self, *args, **kw)
Create image item with coordinates x1,y1.
 
create_line(self, *args, **kw)
Create line with coordinates x1,y1,...,xn,yn.
 
create_oval(self, *args, **kw)
Create oval with coordinates x1,y1,x2,y2.
 
create_polygon(self, *args, **kw)
Create polygon with coordinates x1,y1,...,xn,yn.
 
create_rectangle(self, *args, **kw)
Create rectangle with coordinates x1,y1,x2,y2.
 
create_text(self, *args, **kw)
Create text with coordinates x1,y1.
 
create_window(self, *args, **kw)
Create window with coordinates x1,y1,x2,y2.
 
dchars(self, *args)
Delete characters of text items identified by tag or id in ARGS (possibly several times) from FIRST to LAST character (including).
 
delete(self, *args)
Delete items identified by all tag or ids contained in ARGS.
 
dtag(self, *args)
Delete tag or id given as last arguments in ARGS from items identified by first argument in ARGS.
 
find(self, *args)
Internal function.
 
find_above(self, tagOrId)
Return items above TAGORID.
 
find_all(self)
Return all items.
 
find_below(self, tagOrId)
Return all items below TAGORID.
 
find_closest(self, x, y, halo=None, start=None)
Return item which is closest to pixel at X, Y.
 
find_enclosed(self, x1, y1, x2, y2)
Return all items in rectangle defined by X1,Y1,X2,Y2.
 
find_overlapping(self, x1, y1, x2, y2)
Return all items which overlap the rectangle defined by X1,Y1,X2,Y2.
 
find_withtag(self, tagOrId)
Return all items with TAGORID.
 
focus(self, *args)
Set focus to the first item specified in ARGS.
 
gettags(self, *args)
Return tags associated with the first item specified in ARGS.
 
icursor(self, *args)
Set cursor at position POS in the item identified by TAGORID.
 
index(self, *args)
Return position of cursor as integer in item specified in ARGS.
 
insert(self, *args)
Insert TEXT in item TAGORID at position POS.
 
itemcget(self, tagOrId, option)
Return the resource value for an OPTION for item TAGORID.
 
itemconfigure(self, tagOrId, cnf=None, **kw)
Configure resources of an item TAGORID.
 
itemconfig(self, tagOrId, cnf=None, **kw)
Configure resources of an item TAGORID.
 
tag_lower(self, *args)
Lower an item TAGORID given in ARGS (optional below another item).
 
lower(self, *args)
Lower an item TAGORID given in ARGS (optional below another item).
 
move(self, *args)
Move an item TAGORID given in ARGS.
 
postscript(self, cnf={}, **kw)
Print the contents of the canvas to a postscript file.
 
tag_raise(self, *args)
Raise an item TAGORID given in ARGS (optional above another item).
 
tkraise(self, *args)
Raise an item TAGORID given in ARGS (optional above another item).
 
lift(self, *args)
Raise an item TAGORID given in ARGS (optional above another item).
 
scale(self, *args)
Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.
 
scan_mark(self, x, y)
Remember the current X, Y coordinates.
 
scan_dragto(self, x, y, gain=10)
Adjust the view of the canvas to GAIN times the difference between X and Y and the coordinates given in scan_mark.
 
select_adjust(self, tagOrId, index)
Adjust the end of the selection near the cursor of an item TAGORID to index.
 
select_clear(self)
Clear the selection if it is in this widget.
 
select_from(self, tagOrId, index)
Set the fixed end of a selection in item TAGORID to INDEX.
 
select_item(self)
Return the item which has the selection.
 
select_to(self, tagOrId, index)
Set the variable end of a selection in item TAGORID to INDEX.
 
type(self, tagOrId)
Return the type of the item TAGORID.
 
xview(self, *args)
Query and change horizontal position of the view.
 
xview_moveto(self, fraction)
Adjusts the view in the window so that FRACTION of the total width of the canvas is off-screen to the left.
 
xview_scroll(self, number, what)
Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).
 
yview(self, *args)
Query and change vertical position of the view.
 
yview_moveto(self, fraction)
Adjusts the view in the window so that FRACTION of the total height of the canvas is off-screen to the top.
 
yview_scroll(self, number, what)
Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).

Inherited from BaseWidget: destroy

Inherited from BaseWidget (private): _do, _setup

Inherited from Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, 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, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Place: place, place_configure, place_forget, place_info

Inherited from Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Inherited from Tix.Form: check, form

Class Variables [hide private]

Inherited from Misc: _noarg_

Inherited from Misc (private): _subst_format, _subst_format_str, _tclCommands

Method Details [hide private]

__init__(self, master=None, cnf={}, **kw)
(Constructor)

 

Construct a canvas widget with the parent MASTER.

Valid resource names: 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.

Overrides: BaseWidget.__init__

addtag_closest(self, newtag, x, y, halo=None, start=None)

 

Add tag NEWTAG to item which is closest to pixel at X, Y. If several match take the top-most. All items closer than HALO are considered overlapping (all are closests). If START is specified the next below this tag is taken.

bbox(self, *args)

 

Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle which encloses all items with tags specified as arguments.

Overrides: Grid.grid_bbox

tag_bind(self, tagOrId, sequence=None, func=None, add=None)

 

Bind to all items with TAGORID at event SEQUENCE a call to function FUNC.

An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.

find_closest(self, x, y, halo=None, start=None)

 

Return item which is closest to pixel at X, Y. If several match take the top-most. All items closer than HALO are considered overlapping (all are closests). If START is specified the next below this tag is taken.

focus(self, *args)

 

Set focus to the first item specified in ARGS.

Overrides: Misc.focus_set

icursor(self, *args)

 

Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.

insert(self, *args)

 

Insert TEXT in item TAGORID at position POS. ARGS must be TAGORID POS TEXT.

itemconfigure(self, tagOrId, cnf=None, **kw)

 

Configure resources of an item TAGORID.

The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method without arguments.

itemconfig(self, tagOrId, cnf=None, **kw)

 

Configure resources of an item TAGORID.

The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method without arguments.

lower(self, *args)

 

Lower an item TAGORID given in ARGS (optional below another item).

Overrides: Misc.lower

postscript(self, cnf={}, **kw)

 

Print the contents of the canvas to a postscript file. Valid options: colormap, colormode, file, fontmap, height, pageanchor, pageheight, pagewidth, pagex, pagey, rotate, witdh, x, y.

tkraise(self, *args)

 

Raise an item TAGORID given in ARGS (optional above another item).

Overrides: Misc.tkraise

lift(self, *args)

 

Raise an item TAGORID given in ARGS (optional above another item).

Overrides: Misc.tkraise