I'm trying to wrap a subset of a Tcl/Tk widget set called tclmacbag (see 
http://tclmacbag.autons.net/) for use in my Tkinter application, using a 
"macnotebook" class.  I'm having some difficulty getting things 
configured correctly.

Here is my class code:

from Tkinter import *

class Macnotebook:

       def __init__(self, master):

          self.master = master
          self.master.call('package', 'require', 'tclmacbag')


       def notebook(self):

          self.master.call('::tclmacbag::pnb', self)

        
       def add(self, child):
           self.master.call('::tclmacbag::pnb', 'add', child)

Here is an example of how I'm calling this in my code:

from Macnotebook import Macnotebook

         self.prefbook = Macnotebook.notebook(self.prefframe)
         self.prefbook.pack(fill=BOTH, expand=YES, side=TOP)

This returns the following error in my console:

Traceback (most recent call last):

     self.prefbook = Macnotebook.notebook(self.prefframe)
TypeError: unbound method notebook() must be called with Macnotebook 
instance as first argument (got Frame instance instead)

Can anyone suggest how I might better structure the class so that this 
works? I'm a bit of a newbie with OO, so any pointers are appreciated.

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to