def draw(self, c, r): c.backcolor = rgb(0.94, 0.94, 0.94) c.erase_rect(r) main_image_pos = (int(self.width/2-80), int(self.height/2-90)) src_rect = self.image.bounds #say("Image bounds =", src_rect) dst_rect = offset_rect(src_rect, main_image_pos) #say("Drawing", src_rect, "in", dst_rect) self.image.draw(c, src_rect, dst_rect)
def _get_color(self, color_spec): key = repr(color_spec) if key in _color_map: return _color_map[key] c = map(lambda x: x / 255, map(float, color_spec)) _color_map[key] = r = rgb(*c) return r
def gen_render_color(self, color_spec): c = map(lambda x: x / 255, map(float, color_spec)) return rgb(*c)
# # Python GUI - Standard Colors - Generic # from GUI.Colors import rgb, selection_forecolor, selection_backcolor black = rgb(0, 0, 0) dark_grey = rgb(0.25, 0.25, 0.25) grey = rgb(0.5, 0.5, 0.5) light_grey = rgb(0.75, 0.75, 0.75) white = rgb(1, 1, 1) red = rgb(1, 0, 0) green = rgb(0, 1, 0) blue = rgb(0, 0, 1) yellow = rgb(1, 1, 0) cyan = rgb(0, 1, 1) magenta = rgb(1, 0, 1) clear = rgb(0, 0, 0, 0)