Newbie: Problem with QTable

Andrew Dalke dalke at dalkescientific.com
Sun Apr 28 15:13:31 EDT 2002


Jeff Layton:
>   I hate to bother everyone, but I'm trying to figure out how to
>use QTable. I cooked up a small code that doesn't work (natch).
  ...
>Traceback (most recent call last):
>  File "table1.py", line 17, in ?
>    table=MyTable(numRows, numCols)
>  File "table1.py", line 12, in __init__
>    self.setCaption("Table1")
>AttributeError: sipThis

Looks like you forgot to call the QTable constructor.  Looking at
your code:
    class MyTable( qttable.QTable ):
        def __init__(self, rows, cols):
            """ help me """
            self.setCaption("Table1")

yep, that's your problem.  Try this instead

    class MyTable( qttable.QTable ):
        def __init__(self, rows, cols):
            """ help me """
            qtable.QTable.__init__(self, rows, cols)
            self.setCaption("Table1")

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list