Make the code to run with the main Window.THere is some problem at the present commit but I don't know how to solve it.