Skip to content

Instantly share code, notes, and snippets.

@0xa
Created September 12, 2017 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xa/830f8fb4b53f44d11be49507c5f04f32 to your computer and use it in GitHub Desktop.
Save 0xa/830f8fb4b53f44d11be49507c5f04f32 to your computer and use it in GitHub Desktop.
class WLabel(WLabel):
def set_text(self, text):
self.t = text
self.w = len(text)
class WColorLabel(WLabel):
def __init__(self, text, fg=None, bg=-1):
self.c = (fg, bg) if fg else None
super().__init__(text)
def set_text(self, text, fg=None, bg=-1):
self.t = text
self.w = len(text)
self.c = (fg, bg) if fg is not None else None
def redraw(self):
self.goto(self.x, self.y)
if self.c:
self.attr_color(*self.c)
self.wr(self.t)
if self.c:
self.attr_reset()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment