[wxPython] wxTreeCtrl/wxGTK questions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] wxTreeCtrl/wxGTK questions

Hannu Krosing-4
Hi

It seems that neither wxtreeCtrl window style (wxTR_HAS_BUTTONS,
wxTR_EDIT_LABELS) has any effect on wxGTK.

I have also been unable to use images in tree-items.

Should it be possible ?

Is there a nice little example somewhere ?

Is ther a comparison cart of implemented features
of various wxWindowses ?

-----
Hannu


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl/wxGTK questions

Hannu Krosing-4
As I've found answers to some of my questions, I'm following
up my questions

I wrote:
>
> Hi
>
> It seems that neither wxtreeCtrl window style (wxTR_HAS_BUTTONS,
> wxTR_EDIT_LABELS) has any effect on wxGTK.

I'm still unable to use them ;(
 
> I have also been unable to use images in tree-items.
> Should it be possible ?
> Is there a nice little example somewhere ?

After figuring out that wxListCtrl and wxTreeCtrl do it the same
way, I was able to do it -> the trick was to use wxImageList:

-----8<-------------8<-------------8<-------------8<--------
class myItemTreeCtrlPanel(wxPanel):
    def __init__(self, parent,treeitemnames):
        wxPanel.__init__(self, parent, -1)

        tID = NewId()

        # make image list
        self.il = wxImageList(16,16)
        img1 =
self.il.Add(wxNoRefBitmap('Icons/xpm/tb_trash.xpm',wxBITMAP_TYPE_XPM))
        img2 =
self.il.Add(wxNoRefBitmap('Icons/xpm/tb_volume.xpm',wxBITMAP_TYPE_XPM))
        img3 =
self.il.Add(wxNoRefBitmap('Icons/xpm/tb_undelete.xpm',wxBITMAP_TYPE_XPM))
        self.tree = wxTreeCtrl(self, tID,
wxDefaultPosition,wxDefaultSize,wxTR_EDIT_LABELS)
        self.tree.SetImageList(self.il)
        root = self.tree.AddRoot("Database: [template1]", img1, img3)
        for item in treeitemnames:
            child = self.tree.AppendItem(root, item, img1, img2)
        self.tree.Expand(root)
        EVT_TREE_ITEM_EXPANDED  (self, tID, self.OnItemExpanded)
        EVT_TREE_ITEM_COLLAPSED (self, tID, self.OnItemCollapsed)
        EVT_TREE_SEL_CHANGED    (self, tID, self.OnSelChanged)
-----8<-------------8<-------------8<-------------8<--------

-------------
Hannu


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl/wxGTK questions

Robin Dunn
> >
> > It seems that neither wxtreeCtrl window style (wxTR_HAS_BUTTONS,
> > wxTR_EDIT_LABELS) has any effect on wxGTK.
>
> I'm still unable to use them ;(

Does the tree in the demo not work?  It does for me.

>  
> > I have also been unable to use images in tree-items.
> > Should it be possible ?
> > Is there a nice little example somewhere ?
>
> After figuring out that wxListCtrl and wxTreeCtrl do it the same
> way, I was able to do it -> the trick was to use wxImageList:
>

Oh good.  I wasn't sure what you were after before.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl/wxGTK questions

Hannu Krosing-4
Robin Dunn wrote:
>
> > >
> > > It seems that neither wxtreeCtrl window style (wxTR_HAS_BUTTONS,
> > > wxTR_EDIT_LABELS) has any effect on wxGTK.
> >
> > I'm still unable to use them ;(
>
> Does the tree in the demo not work?  It does for me.

The demo does work, but it works exactly the same whatever
I give it as style (wxTR_HAS_BUTTONS,wxTR_EDIT_LABELS,
wxTR_HAS_BUTTONS|wxTR_EDIT_LABELS,).

So I assume that they have no effect on wxGtk.

Is it so or is there some additional wizardry required to
make them work ?

> > > I have also been unable to use images in tree-items.
> > > Should it be possible ?
> > > Is there a nice little example somewhere ?
> >
> > After figuring out that wxListCtrl and wxTreeCtrl do it the same
> > way, I was able to do it -> the trick was to use wxImageList:
> >
>
> Oh good.  I wasn't sure what you were after before.

I must learn to ask better questions ;)

-------------------
Hannu


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users