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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:29:06+00:00 2026-05-30T00:29:06+00:00

So I am making a GUI to get tweets. I have made an event

  • 0

So I am making a GUI to get tweets. I have made an event box which would take the signal and change the textview.
I am using multiprocessing to change the textview, but it just doesn’t change. I even tried changing the size of the window. But nothing changes. I can get textbuffer of the textview but can not change it.

import pygtk
pygtk.require('2.0')
import gtk
from multiprocessing import Process

class multi:
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_size_request(800,400)
        self.window.set_title("Twitter Box")
        self.window.set_border_width(4)
        self.window.connect("destroy", self.close_application)

        self.vbox1 = gtk.EventBox()
        self.vbox1.set_size_request(750,450)
        self.vbox1.connect('leave_notify_event',self.go_multi)
        self.window.add(self.vbox1)
        self.vbox1.show()

        self.tweetview = gtk.TextView()
        self.tweetbuffer = self.tweetview.get_buffer()
        self.tweetbuffer.set_text('Why not working?')
        self.vbox1.add(self.tweetview)
        self.tweetview.show()

        self.window.show()

    def close_application(self, widget):
        gtk.main_quit()

    def go_multi(self, widget, data=None):
        p = Process(target = self.change_textview)
        p.start()
        p.join()

    def change_textview(self):
        print 'changing text'
        startiter = self.tweetbuffer.get_start_iter()
        enditer = self.tweetbuffer.get_end_iter()
        text = self.tweetbuffer.get_text(startiter, enditer)
        print text
        if text:
            self.tweetbuffer.set_text('Changed....')
        else:
            self.tweetbuffer.set_text('')
        return 

def main():
    multi()
    gtk.main()

if __name__ == '__main__':
    main()

I am making GUI to get tweets. Sometimes it takes really long to retrieve timeline due to slow connectivity and the GUI freezes. So, I wanted to make it such that, it would create a process and it will fetch the timeline and set tweetbuffer. But I am unable to set text in tweetbuffer.

  • 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-30T00:29:08+00:00Added an answer on May 30, 2026 at 12:29 am

    I don’t fully inderstand why you do this:

    def go_multi(self, widget, data=None):
        p = Process(target = self.change_textview)
        p.start()
        p.join()
    

    because, even in the remote possibility in which it should work, you’re basically calling the change_textview function and waiting for the process to finish.

    Cleared this, I don’t think you need multiprocessing at all, make your gui multithreading instead.

    Make a Gtk multithread may be a little tricky at first, but it’s not a difficult task.
    You have two ways for doing so:

    1. Update your widget using GLib.idle_add (or GObject.idle_add, I never fully understand why sometimes they’re not the same)
    2. Or follow what’s explained [here]. Which it basically says to:

      • Call the following methods before you call Gtk.main():

         GObject.threads_init()
         Gdk.threads_init()
        
      • In your thread, surround the code that updates the Gtk widgets with:

         Gdk.threads_enter()
         # your code here
         Gdk.threads_leave()
        
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a Gui API for games. Basically I have event callbacks in my
I am learning swings for making GUI. I was thinking which is the best
I am using Java Netbeans GUI Builder for making GUI. I want to give
I am making a little GUI frontend for a app at the moment using
I am making an application in C# which uses a winform as the GUI
I have a GUI which allows the user to select a report to view/edit.
I have just made my first proper little desktop GUI application that basically wraps
I have written a Matlab GUI for my C program. I thought about using
I'm making a Win32 GUI project using Code::Blocks and the MinGW compiler. At this
The sampled code below is for the GUI I am currently making. I have

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.