[wxpython-users] Re: wxTreeListCtrl

ARCHER, Thomas THOMAS.ARCHER at airbus.com
Fri Apr 25 00:33:19 PDT 2008


Here's a quick app I knocked up. Notice how item 3 appears off to the side. 
Removing the image list solves this, but I need images, so that isn't practical.
Adding the style flag wx.TR_LINES_AT_ROOT seems to improve things (icons appear
in the right place) but leaves small horizontal dotted lines behind the text.
Maybe it's just a matter of getting the right combination of flags ;-).

Also, in terms of hiding the header, any ideas of how to attempt removing it?

Regards,
Tom

 
import wx
from wx import gizmos
class TreeTest(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.ID_ANY, size=(400,200))
        
        tree = gizmos.TreeListCtrl(self,style=wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS|wx.TR_FULL_ROW_HIGHLIGHT , size=(400,200))        
        tree.AddColumn('Test')
        tree.AddColumn('Test1')
        self.root = tree.AddRoot('Root')
        treeItem = tree.AppendItem(self.root, 'Item1')
        treeItem2 = tree.AppendItem(treeItem, 'Item2')
        treeItem3 = tree.AppendItem(self.root, 'Item3')

        self.imgList = wx.ImageList(16,16)
        tree.AssignImageList(self.imgList)

app = wx.App()
frame = wx.Frame(None, -1, 'TreeTest')
TreeTest(frame)
frame.Show()
app.MainLoop()

------------------------------

> I'm using wxTreeListCtrl, and it's going better than my use of    
> MultiSplitterWindow ;-).
> Just wondering if it's possible to hide the column headers, like you  
>   can do with ListCtrl.
> I've tried:
> 	self.GetHeaderWindow().Hide()
> which removes them, but leaves behind a grey bar which I can't seem   
>  to move. I've also
> tried applying various styles, with no effect. Any ideas?

There is a TODO comment in the code that says it would be nice to be
able to provide a style to do that, so I guess that means that is
hasn't been done yet.


>
> Also, when I use the styles wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS and    
> then try and set an
> image list using AssignImageList, some of my tree items disappear    
> off the left of the
> widget if they dont have children. Is this a known bug or am I doing  
>   something wrong?

Not sure.  Please make a small runnable sample that shows the problem.


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




The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other then the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free.



More information about the wxpython-users mailing list