Dear List,
I've been trying to adapt someone else's wxPython code, which is a
little old, and so I've had to update a few things. Most of it was easy
(search and replace wxZZZ with wx.ZZZ) but I'm stuck on a few bits.
The first is adding some bitmaps. Here, self.il is a wx.ImageMap(32,32)
self.idx1 = idx1 = self.il.Add(wx.NoRefBitmap('Dbicon/table.bmp',
wx.BITMAP_TYPE_BMP))
I've tried altering this to:
self.idx1 = idx1 = self.il.Add(wx.Bitmap(<file>, wx.BITMAP_TYPE_BMP)
but I get an error message about "maybe it working on this platform, but
not on Windows, and what looks like a C error:
return _gdi_.ImageList_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "(bitmap.GetWidth() == m_width
&& bitmap.GetHeight() == m_height) || (m_width == 0 && m_height == 0)"
failed in ../src/generic/imaglist.cpp(81): invalid bitmap size in
wxImageList: this might work on this platform but definitely won't under
Windows.
The second one is:
self.list.Connect(-1, -1, wx.EVT_LEFT_DCLICK, self.OnLeftButtonEvent)
Which throws the error:
return _core_.EvtHandler_Connect(*args, **kwargs)
TypeError: argument number 4: a 'number' is expected, 'PyEventBinder
(<wx._core.PyEventBinder object at 0xb7bce8cc>)' is received
I've read the documentation, and it looks as though the syntax here is
correct - but there's obviously a problem.
Thanks a lot for any help,
Matt
Hello Matt,
what if you try instead:
self.list.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftButtonEvent, id=-1)
···
On Thu, 22 Sep 2005 22:38:38 +0100, Matt Williams <matthew.williams@cancer.org.uk> wrote:
[...]
The second one is:
self.list.Connect(-1, -1, wx.EVT_LEFT_DCLICK, self.OnLeftButtonEvent)
Which throws the error:
return _core_.EvtHandler_Connect(*args, **kwargs)
TypeError: argument number 4: a 'number' is expected, 'PyEventBinder
(<wx._core.PyEventBinder object at 0xb7bce8cc>)' is received
I've read the documentation, and it looks as though the syntax here is
correct - but there's obviously a problem.
Thanks a lot for any help,
Matt
--
Franz Steinhaeusler
Hm, not much help here.
when I try for example:
il = wx.ImageList(32, 32)
il.Add(wx.Bitmap("C:\\WINDOWS\\winnt256.bmp", wx.BITMAP_TYPE_BMP))
0
everything is ok, even when the picture (winnt256.bmp) is much bigger
than 32x32.
Have you tried (only for testing) another bitmap?
···
On Thu, 22 Sep 2005 22:38:38 +0100, Matt Williams <matthew.williams@cancer.org.uk> wrote:
I've tried altering this to:
self.idx1 = idx1 = self.il.Add(wx.Bitmap(<file>, wx.BITMAP_TYPE_BMP)
but I get an error message about "maybe it working on this platform, but
not on Windows, and what looks like a C error:
return _gdi_.ImageList_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "(bitmap.GetWidth() == m_width
&& bitmap.GetHeight() == m_height) || (m_width == 0 && m_height == 0)"
failed in ../src/generic/imaglist.cpp(81): invalid bitmap size in
wxImageList: this might work on this platform but definitely won't under
Windows.
--
Franz Steinhaeusler