def wait_until_stable(lp): xpos = qterm.caretX(lp) ypos = qterm.caretY(lp) small_sleep() x = qterm.caretX(lp) y = qterm.caretY(lp) while x != xpos or y != ypos: xpos = x ypos = y small_sleep() x = qterm.caretX(lp) y = qterm.caretY(lp)
def wait_until_change(lp): xpos = qterm.caretX(lp) ypos = qterm.caretY(lp) line = qterm.getText(lp, ypos) small_sleep() x = qterm.caretX(lp) y = qterm.caretY(lp) str = qterm.getText(lp, y) t = maxtry while x == xpos and y == ypos and str == line and t > 0: small_sleep() x = qterm.caretX(lp) y = qterm.caretY(lp) str = qterm.getText(lp, y) t -= 1