class documentation

class CanvasFrame(object): (source)

Constructor: CanvasFrame(parent, **kw)

View In Hierarchy

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.

Method __init__ Create a new CanvasFrame.
Method add_widget 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 ...
Method canvas No summary
Method destroy Destroy this CanvasFrame. If this CanvasFrame created a top-level window, then this will close that window.
Method destroy_widget Remove a canvas widget from this CanvasFrame. This deregisters the canvas widget, and destroys it.
Method mainloop Enter the Tkinter mainloop. This function must be called if this frame is created from a non-interactive program (e.g. from a secript); otherwise, the frame will close as soon as the script completes.
Method pack Pack this CanvasFrame. See the documentation for Tkinter.Pack for more information.
Method print_to_file Print the contents of this CanvasFrame to a postscript file. If no filename is given, then prompt the user for one.
Method remove_widget Undocumented
Method scrollregion No summary
Method _find_room Try to find a space for a given widget.
Method _init_menubar Undocumented
Instance Variable _canvas Undocumented
Instance Variable _frame Undocumented
Instance Variable _parent Undocumented
Instance Variable _scrollwatcher Undocumented
def __init__(self, parent=None, **kw): (source)

Create a new CanvasFrame.

Parameters
parent:Tkinter.BaseWidget or Tkinter.TkThe parent Tkinter widget. If no parent is specified, then CanvasFrame will create a new main window.
**kwKeyword arguments for the new Canvas. See the documentation for Tkinter.Canvas for more information.
def add_widget(self, canvaswidget, x=None, y=None): (source)

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:CanvasWidgetThe new canvas widget. canvaswidget must have been created on this CanvasFrame's canvas.
x:intThe initial x coordinate for the upper left hand corner of canvaswidget, in the canvas's coordinate space.
y:intThe initial y coordinate for the upper left hand corner of canvaswidget, in the canvas's coordinate space.
def canvas(self): (source)
Returns
Tkinter.CanvasThe canvas managed by this CanvasFrame.
def destroy(self, *e): (source)

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

def destroy_widget(self, canvaswidget): (source)

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

def mainloop(self, *args, **kwargs): (source)

Enter the Tkinter mainloop. This function must be called if this frame is created from a non-interactive program (e.g. from a secript); otherwise, the frame will close as soon as the script completes.

def pack(self, cnf={}, **kw): (source)

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

def print_to_file(self, filename=None): (source)

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

Parameters
filename:strThe name of the file to print the tree to.
Returns
NoneUndocumented
def remove_widget(self, canvaswidget): (source)

Undocumented

def scrollregion(self): (source)
Returns
4-tuple of intThe current scroll region for the canvas managed by this CanvasFrame.
def _find_room(self, widget, desired_x, desired_y): (source)

Try to find a space for a given widget.

def _init_menubar(self): (source)

Undocumented

Undocumented

Undocumented

Undocumented

_scrollwatcher = (source)

Undocumented