Cleaned up Python widget code.