[wxPython] wxTreeCtrl::SetItemImage?

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

[wxPython] wxTreeCtrl::SetItemImage?

Simo Haapakka
wxTreeCtrl::SetItemImage ?

can somebody give me an example how to set wxTreeItems image



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



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl::SetItemImage?

Stephen Pitts
On Sun, Sep 12, 1999 at 11:51:27PM +0300, Simo Haapakka wrote:
> wxTreeCtrl::SetItemImage ?
>
> can somebody give me an example how to set wxTreeItems image
>

Check wxTreeCtrl.py in the demo subdirectory...the demo contains lots of
good example code.
--
Stephen Pitts
[hidden email]
webmaster - http://www.mschess.org

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



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl::SetItemImage?

Robin Dunn
In reply to this post by Simo Haapakka
> wxTreeCtrl::SetItemImage ?
>
> can somebody give me an example how to set wxTreeItems image
>

You first have to create a wxImageList, fill it with the images you need,
and associate it with the wxTreeCtrl with SetImageList.  Then you can call
SetItemImage with the index of an image in the imagelist that you want to
use.

--
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::SetItemImage?

Hannu Krosing-2
In reply to this post by Simo Haapakka
Simo Haapakka wrote:
>
> wxTreeCtrl::SetItemImage ?
>
> can somebody give me an example how to set wxTreeItems image

You are probbaly missing the fact that you need to make a wxImageList
first

Here is a part of my program that makes a tree with images, i guess
you can use the same kind of images for SetItemImage.

class dbItemTreeCtrlPanel(wxPanel):
    def __init__(self, parent):
        wxPanel.__init__(self, parent, -1)

        tID = NewId()

        # make image list
        self.il = wxImageList(16,16)
        img1 =
self.il.Add(wxNoRefBitmap('Icons/DB/db16.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)

....

BTW, you may find some info on using images with trees from wxList
examples,
at least thats how I found it

--------
Hannu


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