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

  • Home
  • SEARCH
  • 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 904337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:01:54+00:00 2026-05-15T16:01:54+00:00

I have GUI application with gtk.Treeview component. It’s model is set to gtk.Treestore, which

  • 0

I have GUI application with gtk.Treeview component. It’s model is set to gtk.Treestore, which I fill with a hierarchical structure. Everything is working fine – the treeview is what I expect it to be.

Now I’d like to filter the leaf nodes to contain only a given string. I tried creating model filter like this:

 self.modelfilter = treestore.filter_new()
 self.modelfilter.set_visible_func(self.visible_cb, self.txt)

and define filtering function like the one below (self.txt is the text i’m filtering):

 def visible_cb(self, model, iter, data):
    return self.txt.lower() in model.get_value(iter, 0).lower()

Unfortunately this approach is not a good one because filtering is done on all nodes, and not only leafs.

Is there an elegant solution for this problem in GTK?

  • 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-05-15T16:01:55+00:00Added an answer on May 15, 2026 at 4:01 pm

    I’ve never used the toolkit, but after browsing through the api docs… wouldn’t the following work?

    def visible_cb(self, model, iter, data):
        return model.iter_has_child(iter) or data.lower() in model.get_value(iter, 0).lower()
    

    Not sure why you’re passing self.txt to set_visible_func and not using the corresponding data argument to visible_cb.

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

Sidebar

Related Questions

I currently have two separate programs: (1) a GTK GUI; (2) a Glut application
I have Qt GUI application which I want that the user will open one
My use case is very simple : I have a GUI application, and inside
I have a Windows GUI application that's using the Qt framework (currently version 3.3.5,
I have to build a GUI application on Windows Mobile, and would like it
In our application we sometimes have to make minor GUI modifications for different customers:
Say you have an application divided into 3-tiers: GUI, business logic, and data access.
I have a simple GUI component written in Java. The class draws an analog
I have just made my first proper little desktop GUI application that basically wraps
I'm trying to write a simple gui-based application in pygtk which provides 'live' previewing

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.