Keep Sharp

Select PyQt4 rectangle by edge/stroke

This tip is about how to make pyqt4 rectangle selectable by its edge (or you call it stroke), by default it's selectable by inner area. To achieve this, basically you need to subclass QGraphicsRectItem and overwrite its shape() function so that its shape is not an area but a ...

Update Matplotlib Plot

This tip is about how to update matplotlib plot, it is based on this great tutorial: Speeding up Matplotlib

I learned two ways of updating matplotlib plot, both require first manually change the content of objects that to be updated. For example, lineObj.set_ydata() for line object, vlinesObj.set_paths() for ...

Debug Python code using Wingdb

This tip is about using wingide 's debugger to debug your python code. Sometimes the python code can run from terminal but not from wingide ui, it mostly is because the python related environmental variable settings are different when python kernel is start from terminal and from wingide. In this ...

Configuration of Multiple Python Versions Using Pyenv

Installation of Pyenv:

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv

Add this to .bashrc file

#Add for pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

To check the available python version for installation, run pyenv install -l. I stalled python3.3.2 using ...