[Glade-users] combobox question

I am not familiar with TreeModel. Does it mean I have to create a treeview widget in Glade instead of a 
combobox widget?
Also, in my other combo box I have items that represent countries, so each item has a country code and its 
name beside it, like this:
AG Argentina
AU Austria
BR Brazil
FR France
Of course, when item is selected I want to display the country name in the box, without the country code. I 
have a feeling I need to use TreeModel for this as well, right? No idea how to do this. Any hints/examples 
will be appreciated.
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.


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100923/732d3e9a/attachment.html 

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