Python 3 compatibility in widget.py and test_widget.py via some ugly fixes, others could probably do better. (Paul)