def validate_port(confvar):
 port_val = confvar.get()
 error_res = [(confvar, 'Port should be an integer between 0 and 65535 (inclusive).')]
 try:
  port = int(port_val)
  if ((port < 0) or (port > 65535)):
   return error_res
 except ValueError:
  return error_res
 return []

def validate_port ( confvar ) : port_val = confvar . get ( ) error_res = [ ( confvar , 'Port should be an integer between 0 and 65535 (inclusive).' ) ] try : port = int ( port_val ) if ( ( port < 0 ) or ( port > 65535 ) ) : return error_res except ValueError : return error_res return [ ]
validate that the value of confvar is between [0 .