I am currently working on an undisclosed project with a senior. It requires a GUI, and bunch of OpenCV codes. We started using pygtk, and openCV. python wrapper for openCV is literally slow and we need a much better performance than that. So, after some tests, we found out that we could use swig bindings. At first, we thought to make swig bindings ourselves, but as we started doing it, we realized it isn’t that easy to bind complete OpenCV library in swig. Hence, we started looking at some other options. os.system() seemed useless.»
I had been looking for some open source project so that I could contribute something and make my profile a bit stronger for GSoC 2012. I couldn’t find anything interesting or anything that I could do. I was afraid as I hadn’t contributed anything to the open source community. I was looking for open source projects in python everywhere. Then I found something interesting that I could do. It was a GSoC 2012 project idea of Gentoo Foundation, and I wanted to contribute to it by adding some patch to Portage, Porthole’s Software Management Tool, which is considered one of the best in Linux community. I joined Gentoo-SOC IRC channel, and talked to mentor named dol-sen. He helped me a lot, gave me a couple of links, so I could start my way into portage development. He told me to install Gentoo, as it was necessary, since I had to work on Portage, and it is built for Gentoo. I tried installing Gentoo, but ended up installing Arch Linux (See previous post).»
May The Guide be with you I was supposed to install gentoo for this gentoo gsoc thing, I started to read about gentoo installation and stuff. Made a bootable liveUSB and booted it. Not to mention that couple of times I couldn’t boot. And once I formatted usb and was unable to detect. Lots of madness.»
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