GridCustEditor.py TypeError: PaintBackground() takes exactly 3 arguments (4 given)

Hopefully self explanatory, I've no idea whether this is a genuine problem or I'm wearing my stupid hat again.

C:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2 GridCustEditor.py
GridCustEditor.py:238: wxPyDeprecationWarning: Using deprecated class PySimpleApp.
   app = wx.PySimpleApp()
MyCellEditor ctor
MyCellEditor: IsAcceptedKey: 109
MyCellEditor: Create
MyCellEditor: SetSize (299, 113, 149, 18)
MyCellEditor: Show(self, 1, <wx.grid.GridCellAttr; proxy of <Swig Object of type 'wxGridCellAttr *' at 0x14fc740> >)
MyCellEditor: BeginEdit (6,2)
MyCellEditor: StartingKey 109
TypeError: PaintBackground() takes exactly 3 arguments (4 given)

···

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

Hi Mark,

···

On Wednesday, January 8, 2014 5:11:57 PM UTC-6, Mark Lawrence wrote:

Hopefully self explanatory, I’ve no idea whether this is a genuine
problem or I’m wearing my stupid hat again.

C:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2
GridCustEditor.py

GridCustEditor.py:238: wxPyDeprecationWarning: Using deprecated class
PySimpleApp.

app = wx.PySimpleApp()

MyCellEditor ctor

MyCellEditor ctor

MyCellEditor: IsAcceptedKey: 109

MyCellEditor: Create

MyCellEditor: SetSize (299, 113, 149, 18)

MyCellEditor: Show(self, 1, <wx.grid.GridCellAttr; proxy of <Swig Object
of type ‘wxGridCellAttr *’ at 0x14fc740> >)

MyCellEditor: BeginEdit (6,2)

MyCellEditor: StartingKey 109

TypeError: PaintBackground() takes exactly 3 arguments (4 given)


My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

It sounds like you are passing too many arguments to the Show method. It is defined as follows: Show(self, show, attr)

I can’t tell from the traceback exactly what you are passing though.

  • Mike

I've upgraded my code to dev75606 and editted the demo file to remove the deprecation warning. If I click on the cell stating "Try to edit this box" and hit just about any key I get the following and Python crashes.

c:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2 GridCustEditor.py
MyCellEditor ctor
MyCellEditor: Create
Traceback (most recent call last):
   File "GridCustEditor.py", line 29, in Create
     self.SetControl(self._tc)
AttributeError: 'MyCellEditor' object has no attribute 'SetControl'
MyCellEditor: SetSize (0, 18, 149, 18)
GridCustEditor.py:43: wxPyDeprecationWarning: Call to deprecated item. Use SetSize instead.
   wx.SIZE_ALLOW_MINUS_ONE)
MyCellEditor: Show(self, True, <wx._grid.GridCellAttr object at 0x01569C48>)

If I just close the window I get the following, I simply don't know what I'm looking at here.

c:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2 GridCustEditor.py
MyCellEditor ctor
Traceback (most recent call last):
   File "GridCustEditor.py", line 241, in <module>
     app.MainLoop()
   File "C:\Python27\lib\site-packages\wxpython_phoenix-3.0.1.dev75606-py2.7-win32.egg\wx\core.py", line 1873, in MainLoop
     rv = wx.PyApp.MainLoop(self)
wx._core.wxAssertionError: C++ assertion "m_count > 0" failed at ..\..\src\common\object.cpp(352) in wxRefCounter::DecRef(): invalid ref data count

···

On 13/01/2014 18:38, Mike Driscoll wrote:

Hi Mark,

On Wednesday, January 8, 2014 5:11:57 PM UTC-6, Mark Lawrence wrote:

    Hopefully self explanatory, I've no idea whether this is a genuine
    problem or I'm wearing my stupid hat again.

    C:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2
    GridCustEditor.py
    GridCustEditor.py:238: wxPyDeprecationWarning: Using deprecated class
    PySimpleApp.
        app = wx.PySimpleApp()
    MyCellEditor ctor
    MyCellEditor: IsAcceptedKey: 109
    MyCellEditor: Create
    MyCellEditor: SetSize (299, 113, 149, 18)
    MyCellEditor: Show(self, 1, <wx.grid.GridCellAttr; proxy of <Swig
    Object
    of type 'wxGridCellAttr *' at 0x14fc740> >)
    MyCellEditor: BeginEdit (6,2)
    MyCellEditor: StartingKey 109
    TypeError: PaintBackground() takes exactly 3 arguments (4 given)

    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.

    Mark Lawrence

It sounds like you are passing too many arguments to the Show method. It
is defined as follows: Show(self, show, attr)

I can't tell from the traceback exactly what you are passing though.

- Mike

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

Sadly I don’t have a good way to test this right now. I have wxPython 2.9 installed with my Python 2.7. When I tried installing wx 3.0 for Python 3.3, I get a bunch of Syntax errors, although I can still import wx. However if I try to run the demo from Python 3.3, I get another exception:

Traceback (most recent call last):
File “C:\Program Files (x86)\wxPython3.0 Docs and Demos\demo\demo.pyw”, line 3, in
import Main
File “C:\Program Files (x86)\wxPython3.0 Docs and Demos\demo\Main.py”, line 1341
exec code in self.modules[modID][0]
^
SyntaxError: invalid syntax

Hopefully someone else has it installed in a handier way than I do right now.

Mike

Mark Lawrence wrote:

···

On 13/01/2014 18:38, Mike Driscoll wrote:

Hi Mark,

On Wednesday, January 8, 2014 5:11:57 PM UTC-6, Mark Lawrence wrote:

Hopefully self explanatory, I've no idea whether this is a genuine
problem or I'm wearing my stupid hat again.

C:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2
GridCustEditor.py
GridCustEditor.py:238: wxPyDeprecationWarning: Using deprecated class
PySimpleApp.
app = wx.PySimpleApp()
MyCellEditor ctor
MyCellEditor: IsAcceptedKey: 109
MyCellEditor: Create
MyCellEditor: SetSize (299, 113, 149, 18)
MyCellEditor: Show(self, 1, <wx.grid.GridCellAttr; proxy of <Swig
Object
of type 'wxGridCellAttr *' at 0x14fc740> >)
MyCellEditor: BeginEdit (6,2)
MyCellEditor: StartingKey 109
TypeError: PaintBackground() takes exactly 3 arguments (4 given)

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

It sounds like you are passing too many arguments to the Show method. It
is defined as follows: Show(self, show, attr)

I can't tell from the traceback exactly what you are passing though.

- Mike

I've upgraded my code to dev75606 and editted the demo file to remove
the deprecation warning. If I click on the cell stating "Try to edit
this box" and hit just about any key I get the following and Python
crashes.

c:\Users\Mark\wxpython\wxPython3.0 Docs and Demos\demo>py -2
GridCustEditor.py
MyCellEditor ctor
MyCellEditor: Create
Traceback (most recent call last):
File "GridCustEditor.py", line 29, in Create
self.SetControl(self._tc)
AttributeError: 'MyCellEditor' object has no attribute 'SetControl'
MyCellEditor: SetSize (0, 18, 149, 18)
GridCustEditor.py:43: wxPyDeprecationWarning: Call to deprecated item.
Use SetSize instead.
wx.SIZE_ALLOW_MINUS_ONE)
MyCellEditor: Show(self, True, <wx._grid.GridCellAttr object at
0x01569C48>)

If I just close the window I get the following, I simply don't know what
I'm looking at here.

The problem is probably starting at the missing SetControl wrapper, and since it isn't there some other methods later on will try to operate on a NULL value. This should be fixed for tonight's daily build.

--
Robin Dunn
Software Craftsman