I started making an application/desktop widget for twitter! I made this thing which I call “tweetBox”! It’s just this widget/application written in python using pygtk/gtk+ for GUI, using which you can tweet! Only tweet!
It was easy. No messed up code. child’s play.
Then I wanted an application which would also get the timeline. Okay so, I made it. Again! No big deal!
So, now the problem started. I did not want to add a button to get timeline. So I made an EventBox, and whenever mouse pointer moves out of the eventbox, it would fetch the timeline. Since BITS net is notorious for its slow connectivity and to add up to that, sometimes, twitter just stops responding to BITS public IP! Due to almost zero connectivity, I don’t receive any data from twitter and my program is just stuck there. GUI hangs/crashes! And meanwhile, I don’t know how many times mouse pointer must have came back and went out of the eventbox and it makes a loop to fetch data which I am never going to get!
To avoid this, I thought to use multiprocessing since as usual I thought gtk and multithreading don’t go together!
Well, so after hours of hard work(yeah! coding is hard work and if your code just doesn’t work then it’s totally hard work!), I asked couple of question on Quora and stackoverflow and the answer just turned me upside down!
stackoverflow - How to modify a textview from a different process ?
Yeah, So, I found out that gtk and multithreading don’t go together!
gtk and multithreading is the correct way.
So, After reading couple of blogs about gtk and multithreading, I made this GUI for application which I call “twitterBox” is working fine. Had some problems in the beginning, but now I’m quite comfortable with it.
Misconceptions about Multithreading and gtk
»