def tscheme_rgb(red, green, blue): colors = (red, green, blue) for x in colors: if x < 0 or x > 1: raise SchemeError("Illegal color intensity in " + repl_str(colors)) scaled = tuple(int(x * 255) for x in colors) return '"#%02x%02x%02x"' % scaled
def tscheme_rgb(red, green, blue): """Return a color from RED, GREEN, and BLUE values from 0 to 1.""" colors = (red, green, blue) for x in colors: if x < 0 or x > 1: raise SchemeError("Illegal color intensity in " + repl_str(colors)) scaled = tuple(int(x*255) for x in colors) return '"#%02x%02x%02x"' % scaled
def tscheme_pixelsize(size): """Change pixel size to SIZE.""" _check_nums(size) if size <= 0 or not isinstance(size, numbers.Integral): raise SchemeError("Invalid pixel size: " + repl_str(size)) tscheme_pixel.size = size
def scheme_print_return(val1, val2): print(repl_str(val1)) return val2
def scheme_error(msg=None): msg = "" if msg is None else repl_str(msg) raise SchemeError(msg)
def scheme_print(val): print(repl_str(val))
def scheme_display(val): if scheme_stringp(val): val = eval(val) print(repl_str(val), end="")
def scheme_print(*vals): vals = [repl_str(val) for val in vals] print(*vals)
def scheme_display(*vals): vals = [ repl_str(eval(val) if scheme_stringp(val) else val) for val in vals ] print(*vals, end="")