Package teamwork :: Package widgets :: Module bigwidgets :: Class CanvasFrame
[hide private]
[frames] | no frames]

Class CanvasFrame

source code

A Tkinter frame containing a canvas and scrollbars. CanvasFrame uses a ScrollWatcherWidget to ensure that all of the canvas widgets contained on its canvas are within its scrollregion. In order for CanvasFrame to make these checks, all canvas widgets must be registered with add_widget when they are added to the canvas; and destroyed with destroy_widget when they are no longer needed.

If a CanvasFrame is created with no parent, then it will create its own main window, including a "Done" button and a "Print" button.

Instance Methods [hide private]
 
__init__(self, parent=None, **kw)
Create a new CanvasFrame.
source code
None
print_to_file(self, filename=None)
Print the contents of this CanvasFrame to a postscript file.
source code
4-tuple of int
scrollregion(self)
Returns: The current scroll region for the canvas managed by this CanvasFrame.
source code
Tkinter.Canvas
canvas(self)
Returns: The canvas managed by this CanvasFrame.
source code
 
add_widget(self, canvaswidget, x=None, y=None)
Register a canvas widget with this CanvasFrame.
source code
 
_find_room(self, widget)
Try to find a space for a given widget.
source code
 
destroy_widget(self, canvaswidget)
Remove a canvas widget from this CanvasFrame.
source code
 
pack(self, cnf={}, **kw)
Pack this CanvasFrame.
source code
 
destroy(self, *e)
Destroy this CanvasFrame.
source code
 
mainloop(self, *args, **kwargs) source code
Method Details [hide private]

__init__(self, parent=None, **kw)
(Constructor)

source code 

Create a new CanvasFrame.

Parameters:
  • parent (Tkinter.BaseWidget or Tkinter.Tk) - The parent Tkinter widget. If no parent is specified, then CanvasFrame will create a new main window.
  • kw - Keyword arguments for the new Canvas. See the documentation for Tkinter.Canvas for more information.

print_to_file(self, filename=None)

source code 

Print the contents of this CanvasFrame to a postscript file. If no filename is given, then prompt the user for one.

Parameters:
  • filename (string) - The name of the file to print the tree to.
Returns: None

scrollregion(self)

source code 
Returns: 4-tuple of int
The current scroll region for the canvas managed by this CanvasFrame.

canvas(self)

source code 
Returns: Tkinter.Canvas
The canvas managed by this CanvasFrame.

add_widget(self, canvaswidget, x=None, y=None)

source code 

Register a canvas widget with this CanvasFrame. The CanvasFrame will ensure that this canvas widget is always within the Canvas's scrollregion. If no coordinates are given for the canvas widget, then the CanvasFrame will attempt to find a clear area of the canvas for it.

Parameters:
  • canvaswidget (CanvasWidget) - The new canvas widget. canvaswidget must have been created on this CanvasFrame's canvas.
  • x (int) - The initial x coordinate for the upper left hand corner of canvaswidget, in the canvas's coordinate space.
  • y (int) - The initial y coordinate for the upper left hand corner of canvaswidget, in the canvas's coordinate space.

destroy_widget(self, canvaswidget)

source code 

Remove a canvas widget from this CanvasFrame. This deregisters the canvas widget, and destroys it.

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

source code 

Pack this CanvasFrame. See the documentation for Tkinter.Pack for more information.

destroy(self, *e)

source code 

Destroy this CanvasFrame. If this CanvasFrame created a top-level window, then this will close that window.