Canvas Class Reference

Inheritance diagram for Canvas:

Inheritance graph
[legend]


Public Member Functions

def __contains__(self, obj)[Inherited from _GraphicsContainer]
def __init__(self, w=200, h=200, bgColor=None, title='Graphics canvas', autoRefresh=True)
def add(self, drawable)
def addHandler(self, handler)[Inherited from _EventTrigger]
def clear(self)[Inherited from _GraphicsContainer]
def close(self)
def getBackgroundColor(self)
def getContents(self)[Inherited from _GraphicsContainer]
def getHeight(self)
def getTitle(self)
def getWidth(self)
def open(self)
def refresh(self, force=False)
def remove(self, drawable)
def removeHandler(self, handler)[Inherited from _EventTrigger]
def saveToFile(self, filename)
def setAutoRefresh(self, autoRefresh=True)
def setBackgroundColor(self, color)
def setHeight(self, h)
def setTitle(self, title)
def setWidth(self, w)
def wait(self)[Inherited from _EventTrigger]


Detailed Description

A window that can be drawn upon.

Member Function Documentation

def __contains__ (   self,
  obj 
) [inherited]

Return True if obj is currently in the container; False otherwise.

def __init__ (   self,
  w = 200,
  h = 200,
  bgColor = None,
  title = "Graphics canvas",
  autoRefresh = True 
)

Create a new drawing canvas.

A new canvas will be created.
  w             width of drawing area (default 200)
  h             height of drawing area (default 200)
  bgColor       color of the background (default 'White')
  title         window title (default 'Graphics Canvas')
  autoRefresh   whether auto-refresh mode is used (default True)

def add (   self,
  drawable 
)

Add the Drawable object to the canvas.

def addHandler (   self,
  handler 
) [inherited]

Register an EventHandler instance with this object.

def clear (   self  )  [inherited]

Remove all objects from the container.

def close (   self  ) 

Close the canvas window (if not already closed).

The window can be reopened with a subsequent call to open().

def getBackgroundColor (   self  ) 

Return the background color as a Color instance.

def getContents (   self  )  [inherited]

Return the contents of the container, sorted by depth.

def getHeight (   self  ) 

Return the height of the canvas.

def getTitle (   self  ) 

Return the title of the window.

def getWidth (   self  ) 

Return the width of the canvas.

def open (   self  ) 

Opens a graphic window (if not already open).

The window can be closed with a subsequent call to close().

def refresh (   self,
  force = False 
)

Forces all internal changes to be rendered to the screen.

This method is only necessary when the auto-refresh property
of the canvas has previously been turned off.  If force is
True then the entire window is redrawn regardless of need.

def remove (   self,
  drawable 
)

Remove the drawable object from the canvas.

def removeHandler (   self,
  handler 
) [inherited]

Unregister an EventHandler instance from this object.

def saveToFile (   self,
  filename 
)

Save a picture of the current canvas to a file.

def setAutoRefresh (   self,
  autoRefresh = True 
)

Change the auto-refresh mode.

When True (the default), every change to the canvas or to an
   object drawn upon the canvas will be immediately rendered to
   the screen.

When False, all changes are recorded internally, yet not shown
   on the screen until the next subsequent call to the refresh()
   method of this canvas.  This allows multiple changes to be
   buffered and rendered all at once.

def setBackgroundColor (   self,
  color 
)

Set the background color.

The parameter can be either:
   - a string with the name of the color
   - an (r,g,b) tuple
   - an existing Color instance

def setHeight (   self,
  h 
)

Reset the canvas height to h.

def setTitle (   self,
  title 
)

Set the title for the canvas window to given string.

def setWidth (   self,
  w 
)

Reset the canvas width to w.

def wait (   self  )  [inherited]

Wait for an event to occur.

When an event occurs, an Event instance is returned
with information about what has happened.


The documentation for this class was generated from the following file:
Generated on Fri Dec 21 18:19:25 2007 by  doxygen 1.5.3