def resize_window_to_be_sane(window,x,y): shape=QDesktopWidget().screenGeometry() w=shape.width()*x h=shape.height()*y window.resize(w,h)