[Glade-users] combobox question




I think I found much simpler way of hiding/removing an item from a combo box. I just use
combobox.remove_text(position)   
where 'position' is the index of the item I want to remove.
It works.
I am still struggling with displaying country names without country codes (see my previous two responses)
 
thanks,
Arthur.
 
Date: Thu, 23 Sep 2010 17:26:03 +0100
Subject: Re: [Glade-users] combobox question
From: johndelaney at gmail.com
To: ashats at hotmail.com
CC: glade-users at lists.ximian.com

On Thu, Sep 23, 2010 at 5:08 PM, Arthur Shats <ashats at hotmail.com> wrote:
I am using Glade-2 and Python (new to Python).
On the widow created in Glade, I have a combobox with 3 items filled in
Glade. Under certain conditon in my code, one of the items in the
combobox does not appy, so I need make that one item insensitive
(unselectable) or preferably hide it all together. How would I accomplish
this if possible?

Use gtk.TreeModelFilter as the model for your combo box, and do one of
the following as appropriate:

1. Add an extra boolean column to the underlying model, and set the
visible column of the filter accordingly. The value of this column
(true/false) will be used to determine which rows are to be displayed.
http://library.gnome.org/devel/pygtk/stable/class-gtktreemodelfilter.html#method-gtktreemodelfilter--set-visible-column

Or

2. Create a new function, the return value of which (true/false) will
decide whether or not to display a given row, and set this as the
visible func in the filter
http://library.gnome.org/devel/pygtk/stable/class-gtktreemodelfilter.html#method-gtktreemodelfilter--set-visible-func
                                          
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100923/f83dff98/attachment.html 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]