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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:39:06+00:00 2026-05-13T11:39:06+00:00

I am using PyGTK to build a GUI application. I want to update the

  • 0

I am using PyGTK to build a GUI application. I want to update the textview widget from another thread but the widget is not getting updated everytime i try an update. What should i do to get a reliable GUI updating?

  • 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-13T11:39:06+00:00Added an answer on May 13, 2026 at 11:39 am

    GTK+ is not thread-safe, so you should not simply call GUI update methods from other threads. glib.idle_add (or gobject.idle_add in older PyGTK versions) can be used for this purpose.

    Instead of writing:

    label.set_text("foo")
    

    you would write:

    glib.idle_add(label.set_text, "foo")
    

    which causes the function call to be queued in GTK+.

    If you need to run multiple statements, it’s often easier to wrap them in a function:

    def idle():
        label1.set_text("foo")
        label2.set_text("bar")
    glib.idle_add(idle)
    

    Make sure that the function passed to idle_add does not return True; otherwise it will be queued again.

    Edit: As Daniel pointed out, you need to call gtk.gdk.threads_init() anywhere in your program first.

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

Sidebar

Related Questions

I am using pygtk. I am not getting what is the difference between connect()
From within a Python GUI (PyGTK) I start a process (using multiprocessing). The process
I'm using a GtkSheet widget in PyGTK to power my application's spreadsheet, and it
I'm trying to build a Python application using pyGTK, treads, and sockets. I'm having
How do I paste HTML data from the X clipboard using PyGTK/GTK+? I would
I've been writing writing a small pygtk application using glade to put together the
I create a combo box using PyGTK: fileAttrCombo = gtk.ComboBox(); I want to attach
I'd been using the answer provided in the PyGTK FAQ , but that doesn't
I am learning Python by building a simple PyGTK application that fetches data from
I'm using Python 2.6 and PyGTK 2.22.6 from the all-in-one installer on Windows XP,

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.