def check_win_pos(pos):
 if (not pos.strip()):
  return dict(valid=True, message='Window position not set (default)')
 pos = pos.lower()
 reg = '(TOP|BOTTOM).?(LEFT|RIGHT)'
 if (not re.match(reg, pos, re.I)):
  msg = 'Try something like top-left or bottom-right (or default)'
  return dict(valid=False, message=msg)
 else:
  p = re.match(reg, pos, re.I).groups()
  p = ('%s-%s' % p)
  msg = ('Window position set to %s' % p)
  return dict(valid=True, message=msg, value=p)

def check_win_pos ( pos ) : if ( not pos . strip ( ) ) : return dict ( valid = True , message = 'Window position not set (default)' ) pos = pos . lower ( ) reg = '(TOP|BOTTOM).?(LEFT|RIGHT)' if ( not re . match ( reg , pos , re . I ) ) : msg = 'Try something like top-left or bottom-right (or default)' return dict ( valid = False , message = msg ) else : p = re . match ( reg , pos , re . I ) . groups ( ) p = ( '%s-%s' % p ) msg = ( 'Window position set to %s' % p ) return dict ( valid = True , message = msg , value = p )
check window position input .