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, int): raise SchemeError("Invalid pixel size: " + repl_str(size)) tscheme_pixel.size = size
def scheme_print(val): print(repl_str(val))
def scheme_error(msg=None): msg = "" if msg is None else repl_str(msg) raise SchemeError(msg)
def scheme_display(val): if scheme_stringp(val): val = eval(val) print(repl_str(val), end="")