With TR_AUTO_CHILD and TR_AUTO_PARENT checkboxes?
I haven't been able to find an example thus far, and the wx demo did
now show those styles.
Thanks
Dustin
With TR_AUTO_CHILD and TR_AUTO_PARENT checkboxes?
I haven't been able to find an example thus far, and the wx demo did
now show those styles.
Thanks
Dustin
Hi,
2010/1/26 Dustin Hice:
With TR_AUTO_CHILD and TR_AUTO_PARENT checkboxes?
I haven't been able to find an example thus far, and the wx demo did
now show those styles.
Well, this depends on what you want to do: the 2 styles
TR_AUTO_CHECK_CHILD and TR_AUTO_CHECK_PARENT are useful only for
checkbox-type items. I am not sure what you are asking here, but a
simple constructor for HyperTreeList would be:
HyperTreeList.__init__(self, parent,
style=wx.TR_DEFAULT_STYLE|TR_AUTO_CHECK_CHILD|TR_AUTO_CHECK_PARENT )
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
Here's what I've tried.
from wx.lib.agw.hypertreelist import
(HyperTreeList,EVT_TREE_ITEM_CHECKED,EVT_TREE_ITEM_CHECKING)
from wx.lib.customtreectrl import
(TR_AUTO_CHECK_CHILD,TR_AUTO_CHECK_PARENT)
HyperTreeList.__init__(self,parent=inparent,style=TR_AUTO_CHECK_CHILD|
wx.TR_HIDE_ROOT | wx.TR_EDIT_LABELS | wx.TR_MULTIPLE |
wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HAS_BUTTONS| wx.TR_TWIST_BUTTONS |
wx.TR_NO_LINES)
When I add a new Item to the list (every item has a checkbox in column
0) the name of the item no longer show up and the checkboxes do not
automatically check/uncheck the children.
Also when I tried to import those styles from wx.lib.agw.hypertreelist
I received
ImportError: cannot import name TR_AUTO_CHECK_CHILD
Here's how I'm adding the checkboxes:
new_item = self.GetMainWindow().AppendItem(item,name)
new_checkbox = wx.CheckBox(self.GetMainWindow())
self.SetItemWindow(new_item,new_checkbox,0)
new_checkbox.Bind(wx.EVT_CHECKBOX, self.OnChecked)
new_checkbox.Bind(wx.EVT_UPDATE_UI, self.OnUpdate)
self.Bind(EVT_TREE_ITEM_CHECKED , self.OnItemChecked)
Dustin
On Jan 27, 3:29 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:
Hi,
2010/1/26 Dustin Hice:
> With TR_AUTO_CHILD and TR_AUTO_PARENT checkboxes?
> I haven't been able to find an example thus far, and the wx demo did
> now show those styles.Well, this depends on what you want to do: the 2 styles
TR_AUTO_CHECK_CHILD and TR_AUTO_CHECK_PARENT are useful only for
checkbox-type items. I am not sure what you are asking here, but a
simple constructor for HyperTreeList would be:HyperTreeList.__init__(self, parent,
style=wx.TR_DEFAULT_STYLE|TR_AUTO_CHECK_CHILD|TR_AUTO_CHECK_PARENT )Andrea.
"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/
Hi,
2010/1/27 Dustin Hice:
Here's what I've tried.
from wx.lib.agw.hypertreelist import
(HyperTreeList,EVT_TREE_ITEM_CHECKED,EVT_TREE_ITEM_CHECKING)
from wx.lib.customtreectrl import
(TR_AUTO_CHECK_CHILD,TR_AUTO_CHECK_PARENT)
HyperTreeList.__init__(self,parent=inparent,style=TR_AUTO_CHECK_CHILD|
wx.TR_HIDE_ROOT | wx.TR_EDIT_LABELS | wx.TR_MULTIPLE |
wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HAS_BUTTONS| wx.TR_TWIST_BUTTONS |
wx.TR_NO_LINES)When I add a new Item to the list (every item has a checkbox in column
0) the name of the item no longer show up and the checkboxes do not
automatically check/uncheck the children.Also when I tried to import those styles from wx.lib.agw.hypertreelist
I receivedImportError: cannot import name TR_AUTO_CHECK_CHILD
Here's how I'm adding the checkboxes:
new_item = self.GetMainWindow().AppendItem(item,name)
new_checkbox = wx.CheckBox(self.GetMainWindow())
self.SetItemWindow(new_item,new_checkbox,0)
new_checkbox.Bind(wx.EVT_CHECKBOX, self.OnChecked)
new_checkbox.Bind(wx.EVT_UPDATE_UI, self.OnUpdate)
self.Bind(EVT_TREE_ITEM_CHECKED , self.OnItemChecked)
No, no, no, don't do that! When I said "checkbox-type" items, I meant
that if you tell HyperTreeList that one item is checkbox-like it will
create the checkbox for it automatically, you don't have to append a
wx.CheckBox to it. For example (self is an HyperTreeList):
# ct_type=1 ==> checkbox-like item
item = self.AppendItem(parentItem, name, ct_type=1)
Also, do not use GetMainWindow() to append an item, GetMainWindow
should be used only while declaring a window associated to an item and
nowhere else. For example:
item = self.AppendItem(parentItem, name, ct_type=1)
textCtrl = wx.TextCtrl(self.GetMainWindow(), -1, "Hello")
self.SetItemWindow(item, textCtrl)
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
I received the error:
new_item = self.AppendItem(item,name,ct_type=1)
TypeError: AppendItem() got an unexpected keyword argument 'ct_type'
Any ideas as to fix this?
Dustin
On Jan 27, 10:14 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:
Hi,
2010/1/27 Dustin Hice:
> Here's what I've tried.
> from wx.lib.agw.hypertreelist import
> (HyperTreeList,EVT_TREE_ITEM_CHECKED,EVT_TREE_ITEM_CHECKING)
> from wx.lib.customtreectrl import
> (TR_AUTO_CHECK_CHILD,TR_AUTO_CHECK_PARENT)
> HyperTreeList.__init__(self,parent=inparent,style=TR_AUTO_CHECK_CHILD|
> wx.TR_HIDE_ROOT | wx.TR_EDIT_LABELS | wx.TR_MULTIPLE |
> wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HAS_BUTTONS| wx.TR_TWIST_BUTTONS |
> wx.TR_NO_LINES)> When I add a new Item to the list (every item has a checkbox in column
> 0) the name of the item no longer show up and the checkboxes do not
> automatically check/uncheck the children.> Also when I tried to import those styles from wx.lib.agw.hypertreelist
> I received> ImportError: cannot import name TR_AUTO_CHECK_CHILD
> Here's how I'm adding the checkboxes:
> new_item = self.GetMainWindow().AppendItem(item,name)
> new_checkbox = wx.CheckBox(self.GetMainWindow())
> self.SetItemWindow(new_item,new_checkbox,0)
> new_checkbox.Bind(wx.EVT_CHECKBOX, self.OnChecked)
> new_checkbox.Bind(wx.EVT_UPDATE_UI, self.OnUpdate)
> self.Bind(EVT_TREE_ITEM_CHECKED , self.OnItemChecked)No, no, no, don't do that! When I said "checkbox-type" items, I meant
that if you tell HyperTreeList that one item is checkbox-like it will
create the checkbox for it automatically, you don't have to append a
wx.CheckBox to it. For example (self is an HyperTreeList):# ct_type=1 ==> checkbox-like item
item = self.AppendItem(parentItem, name, ct_type=1)Also, do not use GetMainWindow() to append an item, GetMainWindow
should be used only while declaring a window associated to an item and
nowhere else. For example:item = self.AppendItem(parentItem, name, ct_type=1)
textCtrl = wx.TextCtrl(self.GetMainWindow(), -1, "Hello")
self.SetItemWindow(item, textCtrl)Andrea.
"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/
Hi,
2010/1/27 Dustin Hice:
I received the error:
new_item = self.AppendItem(item,name,ct_type=1)
TypeError: AppendItem() got an unexpected keyword argument 'ct_type'Any ideas as to fix this?
This is not possible. If you look at the wxPython demo you'll see a
couple of lines like that:
last = self.AppendItem(child, txt, ct_type=2)
Or:
last = self.AppendItem(child, txt, ct_type=1, wnd=textctrl)
So ct_type is there and working. Please show us a small runnable up
demonstrating the problem.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/