Hi, all
CheckListCtrl.py is now updated to 1.3. Several bugs are fixed.
Best regards,
Bruce Who
CheckListCtrl.py (5.34 KB)
CheckListCtrl_demo.py (1.42 KB)
Hi, all
CheckListCtrl.py is now updated to 1.3. Several bugs are fixed.
Best regards,
Bruce Who
CheckListCtrl.py (5.34 KB)
CheckListCtrl_demo.py (1.42 KB)
Hello, i tried it out.
Not so important, but if you quit the app, I got
following traceback:
(wxPy 2.6.2.1, WinXP):
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py", line 13469,
in <lambda>
File "C:\Programme\agent_gmane\CheckListCtrl.py", line 86, in _PaintCheckBox
item_count = self.GetItemCount()
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py", line 13415,
in __getattr__
wx._core.PyDeadObjectError: The C++ part of the CheckListCtrl object has been de
leted, attribute access no longer allowed.
If I replace the CallAfter:
def OnPaint(self, evt):
#wx.CallAfter(self._PaintCheckBox)
self._PaintCheckBox()
then it works.
But I think, it must have a reason to use CallAfter (?).
On Wed, 8 Feb 2006 16:11:04 +0800, Bruce Who <bruce.who.hk@gmail.com> wrote:
Hi, all
CheckListCtrl.py is now updated to 1.3. Several bugs are fixed.
Best regards,
Bruce Who
--
Franz Steinhaeusler
Hi, Franz,
I use wx.CallAfter() intentionally since I want to draw the checkboxes
just after the default OnPaint() is called.
CheckListCtrl_demo.py works fine here(py2.4,wxPy 2.6.2.1, WinXP).
Could you tell me that you simply ran the CheckListCtrl_demo.py script
then the error occured or you used the CheckListCtrl.py in your other
scripts?
You can found some try...except statements(with XXX) in the
CheckListCtrl.py, since before app terminates the ListCtrl is removed
but the OnPaint is still called, so error occurs. I guess the problem
is caused because of this. But I don't know how to test if OnPaint()
is called after ListCtrl is deleted. Could anybody help me?
On 2/8/06, Franz Steinhaeusler <franz.steinhaeusler@gmx.at> wrote:
On Wed, 8 Feb 2006 16:11:04 +0800, Bruce Who <bruce.who.hk@gmail.com> wrote:
>Hi, all
>
>CheckListCtrl.py is now updated to 1.3. Several bugs are fixed.
>
>Best regards,
>
>Bruce WhoHello, i tried it out.
Not so important, but if you quit the app, I got
following traceback:
(wxPy 2.6.2.1, WinXP):Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py", line 13469,
in <lambda>File "C:\Programme\agent_gmane\CheckListCtrl.py", line 86, in _PaintCheckBox
item_count = self.GetItemCount()
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py", line 13415,
in __getattr__wx._core.PyDeadObjectError: The C++ part of the CheckListCtrl object has been de
leted, attribute access no longer allowed.If I replace the CallAfter:
def OnPaint(self, evt):
#wx.CallAfter(self._PaintCheckBox)
self._PaintCheckBox()then it works.
But I think, it must have a reason to use CallAfter (?).
--
Franz Steinhaeusler---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Best regards,
Bruce Who
Hello Bruce,
I started CheckListCtrl_Demo (in Console to see the traceback)
and close it. (Didn't nothing, and it is ok).
The second time, I only checked the first item, then close
the app, the traceback appears. (so checking at least one item
is sufficient to get the traceback).
After some searching, I (hope) I found the solution:
def _PaintCheckBox(self):
try:
item_count = self.GetItemCount()
except wx.PyDeadObjectError:
#print "PyDead"
return
On Wed, 8 Feb 2006 16:39:03 +0800, Bruce Who <bruce.who.hk@gmail.com> wrote:
Hi, Franz,
I use wx.CallAfter() intentionally since I want to draw the checkboxes
just after the default OnPaint() is called.CheckListCtrl_demo.py works fine here(py2.4,wxPy 2.6.2.1, WinXP).
Could you tell me that you simply ran the CheckListCtrl_demo.py script
then the error occured or you used the CheckListCtrl.py in your other
scripts?You can found some try...except statements(with XXX) in the
CheckListCtrl.py, since before app terminates the ListCtrl is removed
but the OnPaint is still called, so error occurs. I guess the problem
is caused because of this. But I don't know how to test if OnPaint()
is called after ListCtrl is deleted. Could anybody help me?
--
Franz Steinhaeusler
Hi, Franz,
I see. I'll update it later. But I believe that there must be a
standard or decent way to handle such situations.
Hello Bruce,
I started CheckListCtrl_Demo (in Console to see the traceback)
and close it. (Didn't nothing, and it is ok).The second time, I only checked the first item, then close
the app, the traceback appears. (so checking at least one item
is sufficient to get the traceback).After some searching, I (hope) I found the solution:
def _PaintCheckBox(self):
try:
item_count = self.GetItemCount()
except wx.PyDeadObjectError:
#print "PyDead"
return
Best regards,
Bruce Who
Bruce Who wrote:
Hi, all
CheckListCtrl.py is now updated to 1.3. Several bugs are fixed.
On Linux (and probably Mac, but I did't test this there) the check boxes are not drawn. This is because the wx.listCtrl on those platforms is not a single window. There is a window for the header and another for the scrollable area. So for non-MSW platforms you'll want to use the child window as the parent of the wx.CheckBox's, perhaps something like this:
parent = self
if 'wxMSW' not in wx.PlatformInfo:
parent = self.GetChildren()[0]
self._rgCheckBox_[i] = wx.CheckBox(parent, -1, '')
You'll also need to adjust the position of the check boxes in this case as well because now the y position of the first item is at 0 relative to this child window.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Bruce Who wrote:
You can found some try...except statements(with XXX) in the
CheckListCtrl.py, since before app terminates the ListCtrl is removed
but the OnPaint is still called, so error occurs. I guess the problem
is caused because of this. But I don't know how to test if OnPaint()
is called after ListCtrl is deleted. Could anybody help me?
The wx._wxPyDeadObject class has a __nonzero__ method, so you can just test self before using it, like this:
if self:
DoSomething()
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
I have write a new module named CheckListCtrlMixin.py, I think this
one is much better than this CheckListCtrl.py, last night I found some
other bugs and that I need to change most interfaces of ListCtrl to
make CheckListCtrl work like a real ListCtrl while it's a good idea to
just use icons as checkboxes. The CheckListCtrlMixin.py is quite
simple but works fine.
On 2/9/06, Robin Dunn <robin@alldunn.com> wrote:
Bruce Who wrote:
> Hi, all
>
> CheckListCtrl.py is now updated to 1.3. Several bugs are fixed.On Linux (and probably Mac, but I did't test this there) the check boxes
are not drawn. This is because the wx.listCtrl on those platforms is
not a single window. There is a window for the header and another for
the scrollable area. So for non-MSW platforms you'll want to use the
child window as the parent of the wx.CheckBox's, perhaps something like
this:parent = self
if 'wxMSW' not in wx.PlatformInfo:
parent = self.GetChildren()[0]
self._rgCheckBox_[i] = wx.CheckBox(parent, -1, '')You'll also need to adjust the position of the check boxes in this case
as well because now the y position of the first item is at 0 relative to
this child window.--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org