Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:23:05+00:00 2026-06-15T13:23:05+00:00

Hi I want to put a selected image an image in the treeItemsCtrl but

  • 0

Hi I want to put a selected image an image in the treeItemsCtrl but i cant find how i tried

    fileopen = wx.Image("../iconos/folder-cerrado.png", wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap()
    fileClose = wx.Image("../iconos/folder-abierto.png", wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap()


    self.tree = wx.TreeCtrl(panel1, 1, wx.DefaultPosition, (-1,-1), wx.TR_HIDE_ROOT)
    root = self.tree.AddRoot('Home')
    os = self.tree.AppendItem(root, 'Documentos', image=fileAbierto, selectedImagefileCerrado)

but it didnt work I have that this error when I try to run it

os = self.tree.AppendItem(root, 'Documentos',fileAbierto,fileCerrado)

File “/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py”, line 5469, in AppendItem
return controls.TreeCtrl_AppendItem(*args, **kwargs)
TypeError: in method ‘TreeCtrl_AppendItem’, expected argument 4 of type ‘int’

I want to do this in the Append Function because I am adding the items in a function thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:23:06+00:00Added an answer on June 15, 2026 at 1:23 pm

    The wxPython demo has an example. It looks like you need to create an ImageList and extract the ids. Then when you set up the tree’s items, you will want to use the SetItemImage method to add the selected icon:

    self.tree.SetItemImage(item, fileidx, wx.TreeItemIcon_Normal)
    self.tree.SetItemImage(item, smileidx, wx.TreeItemIcon_Selected)
    

    So in the demo it shows a folder icon when it’s unselected. Then when it IS selected, it shows a smiley instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to put facility to display distance between two places selected by user.
I have a drop down list and I want the selected value to put
friends, i am trying to display image from gallery now i want to put
I want put in a selected list labels the name and surname of people
I want to show an image in imageview so I made a folder -
i have selected some rows from mysql and i want put underscore between the
I want put a button on android edittextpreference. I create a custom editextpreference: public
I've projected an Intranet Ajax application and I want put it in a full
hey, hi i want put limit on object creation means a class can have
I want to put two side by side on another (I have three )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.