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 8734307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:49:05+00:00 2026-06-13T09:49:05+00:00

I’m using two instances of gtk.TreeStore (in pyGTK 2.10) to create two drop-down menu

  • 0

I’m using two instances of gtk.TreeStore (in pyGTK 2.10) to create two drop-down menu ComboBox widgets; call them device and command. The value selected in the device ComboBox will vary the values available in the command ComboBox. When a command selection is made, the combination of device and command selections are used to do more work (showing other possible parameters, etc.)

Something like this should normally happen:

  1. Populate and set model of device widget
  2. Connect device handler (for “changed” event)
  3. Connect command handler (for “changed” event)
  4. Show device widget
  5. Show command widget
  6. Wait for selection
  7. Process device selection, clearing/populating the model of the command widget
  8. Process command selection
  9. Go to 6

Now, say in the middle of #8, the user is really fast and goes back to select another device and, before that second device-selection event can get handled, they select another command (populated from the initial device selection). The second command-selection event is coming in with context that may no longer be valid after the second device-selection event is processed.

Is the best practice to do something like the following in device-selection processing:

  1. Hide command widget
  2. Clear event queue (by calling gtk.gdk.event_get() on all pending events, freeing as we go)
  3. Clear command widget
  4. [Re-]populate model of command widget
  5. Show command widget

Or is there another more elegant way? I mean, there’s not some automatic event purging that can be forced to happen, right?

  • 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-13T09:49:06+00:00Added an answer on June 13, 2026 at 9:49 am

    I think you’re trying to solve a non-existent issue.

    You’re right that it’s theoretically possible for the next input event to be already waiting while you’re still processing the last one. After all, those events come from the X process, which doesn’t wait for you to handle the event. However, the state of your widgets is updated sequentially in your own main loop. That means that the next input event will be interpreted as if it happened after you changed the state of your widgets.

    That means that if the user clicked somewhere in the top of your device widget while it shows the options for command 1, but while you’re processing the change to command 2, it will eventually be interpreted by your loop as if the user clicked the topmost option corresponding to command 2.

    If the user can click faster than you can process, it’s her responsibility to know that her input may be interpreted different from what she intended. That is reasonable assuming that your processing doesn’t block the application.

    If it does, then I guess best practice would be to make the other widget insensitive while you repopulate it in another thread. I don’t see why that would need any juggling/purging of events.

    As a side note: since you say you’re ‘repopulating’ the widget: have you considered just having several GtkTreeModels for the commands and using gtk_tree_view_set_model?

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I've tracked down a weird MySQL problem to the two different ways I was
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.