[wxPython] Print text from wxTextCtrl using PrintFramework

I am trying to print from wxTextCtrl using PrintFramework as suggested
by Robin Dunn on Jul 3, 2001 (Question about the PrintFramework).

The following code gives me an error

AttributeError: MainWindow instance has no attribute 'canvas'.

Any assistance is appreciated.

···

____________________________

from wxScrolledWindow import MyCanvas
import PrintFramework

...
...

def OnFilePrint(self, evt): # Print
        prntxtctrl = PrintFramework.MyPrintout(self,
            self.control.GetValue())
        self.printData = wxPrintData()
        self.printData.SetPaperId(wxPAPER_LETTER)
        pdd = wxPrintDialogData()
        pdd.SetPrintData(self.printData)
        printer = wxPrinter(pdd)
==> printout = PrintFramework.MyPrintout(self.canvas, self.log)
        if not printer.Print(self, printout):
            wxMessageBox("Printer Problem")
        else:
            self.printData =
printer.GetPrintDialogData().GetPrintData()
        printout.Destory()
            
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

AttributeError: MainWindow instance has no attribute 'canvas'.

The code you copied originally came from the demo, where there is a
self.canvas attribute, and is what is getting drawn. Please refer to that
code for more info.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!