move code to python. rewrite with qt