Menu

Setting raisecommand in NoteBook

Help
John Speno
2002-11-07
2002-11-08
  • John Speno

    John Speno - 2002-11-07

    When I try to set the 'raisecommand' option in PmwNoteBook, I get this:

    TclError Exception in Tk callback
      Function: <class __main__.MiscellaneousTables at 0x7756f8> (type: <type 'class'>)
      Args: ()
    Traceback (innermost last):
      File "Pmw.py", line 1772, in __call__
        return apply(self.func, args)
      File "Window.py", line 98, in __init__
        initialization = self.populate()
      File "MiscellaneousTablesWindow.py", line 260, in populate
        self._makepage(pagename, table['tag'], table['fmt'])
      File "MiscellaneousTablesWindow.py", line 705, in _makepage
        page.configure(raisecommand=command)
      File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 1085, in configure
        self.tk.call((self._w, 'configure')
    TclError: unknown option "-raisecommand"

    Here's a code snippet. Please let me know if you need to see more:
    --snip--
    def command(command=self._enable_buttons, page=pagename):
                command(page)
    page.configure(raisecommand=command)
    --snip--

    Any ideas what's going on?

     
    • Greg McFarlane

      Greg McFarlane - 2002-11-08

      The raisecommand option is an option of a Pmw.NoteBook.  It appears that you are passing the option to one of the pages of the notebook rather than the notebook itself.  So you need to do something like:

      def _enable_buttons(self, pagename):
          print pagename, 'raised'
      notebook.configure(raisecommand=self._enable_buttons)

       
      • John Speno

        John Speno - 2002-11-08

        Yep. That's a problem. I'm trying to port some old Pmw code (used NoteBookR) to the new NoteBook.

        I may just try to get the old NoteBookR widget working with the new Pmw and later python versions depending on how much work it is. Choices!

         

Log in to post a comment.