473,668 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to delete PyGTK ComboBox entries?

Hello list!

I need to repopulate PyGTK ComboBox on a regular basis. In order to do
so I have to remove all the entries and then add the new ones. I tried
to remove all entries like that:

def clear_comboboxe s(boxreference) :
try:
while True:
boxreference.re move_text(0)
except:
pass

And then repopulate by iterating through the list of desired entries and
calling ComboBox.append _text(text). It works, but is painfully
sloooooooow! Is there a faster way to completely change the entries in a
ComboBox, by using an all erase method or overwriting the container
object? I haven't found anything with google, as the searches are too
ambiguous to yield usable results.

Thanks,

Maël
Feb 26 '07 #1
2 6090
ma, 2007-02-26 kello 16:08 +0100, Maël Benjamin Mettler kirjoitti:
I need to repopulate PyGTK ComboBox on a regular basis. In order to do
so I have to remove all the entries and then add the new ones.
And then repopulate by iterating through the list of desired entries and
calling ComboBox.append _text(text). It works, but is painfully
sloooooooow!
model = combo_box.get_m odel()
combo_box.set_m odel(None)
model.clear()
for entry in desired_entries :
model.append([entry])
combo_box.set_m odel(model)

model.append is essentially the same as combo_box.appen d_text. Setting
the model to None before making changes to it speeds things at least in
the case of tree views. I'm not sure if it does much with combo boxes.
If you experince speed issues with combo boxes you're either doing
something very wrong or you have so many entries that you ought to be
using a tree view instead.

--
Osmo Salomaa

Feb 26 '07 #2
Hej!

model = combo_box.get_m odel()
combo_box.set_m odel(None)
model.clear()
for entry in desired_entries :
model.append([entry])
combo_box.set_m odel(model)

model.append is essentially the same as combo_box.appen d_text. Setting
the model to None before making changes to it speeds things at least in
the case of tree views. I'm not sure if it does much with combo boxes.
If you experince speed issues with combo boxes you're either doing
something very wrong or you have so many entries that you ought to be
using a tree view instead.
Works like a charm. Thanks a lot!

Feb 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2595
by: j_mckitrick | last post by:
Hi all. Here is a tiny container for one of each combo box, along with the glade file. Just 2 widgets, so hopefully not too large. How the heck do I get the selection from the ComboBox, as opposed to the ComboEntryBox? I'm pulling my hair out over this one! jonathon
6
4021
by: Bernd Smits | last post by:
Hi, I would like to delete a record (with commandbutton) of a table associated to a combobox, when I select a certain value in the combobox (the value I select is associated with the record that I want to delete. For example: I have a form associated to a table, which has only one field (PatientN°), and a combobox (within the form) that contains the list of values (PatientN°) contained in the table. Now I would like to select a value in...
4
1370
by: John Suru | last post by:
I am loading up a combobox with data from an access database. The field I am loading is a date/time datatype. The data in the field is a short date(ex. 01/22/2004). When I load the combobox with the data it appears correct. When I click on the dropdown arrow of the combobox, all of the entries have 12:00:00 AM added to the end of the date entries. Instead of displaying 01/22/2004 the combobox displays 01/22/2004 12:00:00 AM. What do I need to...
5
7059
by: Peter Stojkovic | last post by:
VB 7.1 and windows.forms. I have a comboBox on a form. When the user goes with TAB-Key to the comboBox, the comboBox should dropDown the ListBox automatically and show ALL entries. The user has no possibility to use a mouse !! How can I program a automatic dropDown ( Showing all entries ), if the user tabs to the comboBox ???
1
2771
by: tizmagik | last post by:
I have a combobox on a continuous form that has a recordsource that is set upon Form_Load event via VBA (based on initial form data and external form data entered). For data entry purposes the Combobox's value is saved to *another* field (text-field) in the appropriate table (this text-field is not visible in the Continuous Form); so the combobox is pretty much just for data-lookup purposes (so the user does not have to type anything). ...
0
1161
by: Fabian Braennstroem | last post by:
Hi, I am just testing pygtk/glade out and wonder, if I am able to change the keybindings. E.g. the treeview searches by default for the entries beginning with the typed keystroke; moving to the next row works as usual with the Down key. Now I would like to change the key bindings to e.g. 'j' to move to the next row (just like in vim) and to use a 'Ctrl' key combination to search for a certain word beginning with the typed key stroke.
5
1497
by: active | last post by:
I tried to use a datasource with a combobox and it didn't work completely so I build a small test that was much more straight forward then the app. The test was to see if the combobox dropdown list displayed the correct data. However, although the designer shows the combobox the combobox does not show at runtime. If you would be so kind as to cut the code below and paste it into a form
9
5517
by: Greg (codepug | last post by:
I have a combobox with the RowSourceType set to Table/Query and the RowSource is an SQL query that references a separate lookup table that contains the data that can be selected in the combobox. Also, limittolist & autoexpand are set to Yes. Control source is set to the main table field where the data will go. I can highlight the data that was previously selected in the combobox, and press the delete key to remove it, but after I move...
0
1598
by: dudeja.rajat | last post by:
On Sat, Aug 30, 2008 at 2:32 PM, Fredrik Lundh <fredrik@pythonware.comwrote: Fredrik, Thanks so much. That worked. Following this, I can now see that my combo2 has no previous elements and contains only the elements relevant to selection in combo1. Now, as soon as I select something in combo 2 and go back to change selection in combo1 the combo2 must get its history cleared up (i.e the previous selection in combo2's entry subwidget)
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7398
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.