Created
September 12, 2017 20:15
-
-
Save 0xa/830f8fb4b53f44d11be49507c5f04f32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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