def resizeWindow(win, w, h, timeout=2.0):
 QtGui.QApplication.processEvents()
 QtTest.QTest.qWaitForWindowShown(win)
 win.resize(w, h)
 start = time.time()
 while True:
  (w1, h1) = (win.width(), win.height())
  if ((w, h) == (w1, h1)):
   return
  QtTest.QTest.qWait(10)
  if ((time.time() - start) > timeout):
   raise TimeoutError(('Window resize failed (requested %dx%d, got %dx%d)' % (w, h, w1, h1)))

def resizeWindow ( win , w , h , timeout = 2.0 ) : QtGui . QApplication . processEvents ( ) QtTest . QTest . qWaitForWindowShown ( win ) win . resize ( w , h ) start = time . time ( ) while True : ( w1 , h1 ) = ( win . width ( ) , win . height ( ) ) if ( ( w , h ) == ( w1 , h1 ) ) : return QtTest . QTest . qWait ( 10 ) if ( ( time . time ( ) - start ) > timeout ) : raise TimeoutError ( ( 'Window resize failed (requested %dx%d, got %dx%d)' % ( w , h , w1 , h1 ) ) )
resize a window and wait until it has the correct size .