[wxPython] Unexpected error messages - wxGrid

I am puzzled that wxGrid appears to reference wxCanvas.

Any advice would be appreciated.

Colin W.

from wxPython.wx import *
from wxPython.grid import *

# -----------------------------------------
class dbGrid(wxGrid):
    def __init__(self,
            parent,
            id=-1,
            pos=wxDefaultPosition,
            size=wxDefaultSize,
            style=wxWANTS_CHARS,
            name="grid",
            log= sys.stdout):
        self.log= log
        self.log.write('\ndbGrid init\n')
        self.log.write('\ndbGrid: '+`wxGrid`)
        self.log.write('\nwxGrid.__init__'+`wxGrid.__init__`+'\n')
        wxGrid.__init__(self,
                parent,
                id,
                pos,
                size,
                style,
                name)
        self.log.write("\n" + `dbGrid.__init__`) # NOT CALLED

def main():
    print '\nmain start\n'
    zzz= dbGrid(parent = None,
        id = -1,
        name = 'grid1',
        pos = wxPoint(0, 8),
        size = wxSize(344, 104),
        style = wxDOUBLE_BORDER,
        log= sys.stdout)
    print '\nzzz: '+`zzz`

if __name__ == '__main__':
    main()

···

#---------------------------------------------------------------------------
Execution Results Follow:

pythonw -u _temp.py

main start

dbGrid init

dbGrid: <class wxPython.grid.wxGrid at 01327A8C>
wxGrid.__init__<unbound method wxGrid.__init__>
18:11:29: Error: Can't create window of class wxCanvasClass!
Possible Windows 3.x compatibility problem?
18:11:29: Error: Can't create window of class wxCanvasClass!
Possible Windows 3.x compatibility problem?
18:11:29: Error: Can't create window of class wxCanvasClass!
Possible Windows 3.x compatibility problem?
18:11:29: Error: Can't create window of class wxCanvasClass!
Possible Windows 3.x compatibility problem?

<unbound method dbGrid.__init__>
zzz: <C wxGrid instance at _1329c40_wxGrid_p>

Exit code: 0

I am puzzled that wxGrid appears to reference wxCanvas.

It doesn't. The message says "wxCanvasClass" which is just an arbitrary
name used to register a window class type with MSW. (Which is a fancy way
to describe a ton of required low-level win32 API stuff that wxWindows hides
from you.)

Since you didn't create a wxApp the library wasn't completely initialized
and the wxCanvasClass wasn't registered with MSW and so the error message is
letting you know that MSW doesn't know anything about it and so can't create
it.

Even if you did create a wxApp your code would not run since a wxGrid is not
a top-level window and so it can't be created with None for the parent...

···

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

Many thanks.

Could I suggest that the list be made available
as well on a news server? The threading of
a news group is a big help.

I see that the wxWindows list, wx-users,
on wx-users@lists.wxwindows.org is relayed
to the news group comp.soft-sys.wxwindows.

I believe that comp.lang.python is similarly
associated with a list server, but I've never
used it.

Use of a news distribution might make it easier
for others to contribute answers. Particularly
a question such as mine, which most experienced
wx people probably already knew. This could
reduce the heavy load you carry.

Colin W.

Colin W.

Robin Dunn wrote:

···

> I am puzzled that wxGrid appears to reference wxCanvas.

It doesn't. The message says "wxCanvasClass" which is just an arbitrary
name used to register a window class type with MSW. (Which is a fancy way
to describe a ton of required low-level win32 API stuff that wxWindows hides
from you.)

Since you didn't create a wxApp the library wasn't completely initialized
and the wxCanvasClass wasn't registered with MSW and so the error message is
letting you know that MSW doesn't know anything about it and so can't create
it.

Even if you did create a wxApp your code would not run since a wxGrid is not
a top-level window and so it can't be created with None for the parent...

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

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

Colin J. Williams wrote:

Many thanks.

Could I suggest that the list be made available
as well on a news server? The threading of
a news group is a big help.

By the way, Netscape Mail (both 4 and 6) has the option of sorting downloaded (POP3) mail messages by thread, just like a news reader.

(Not that this detracts from the merit of your suggestion)

David