diff options
| author | troido <troido@hotmail.com> | 2017-12-28 22:47:36 +0100 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2017-12-28 22:47:36 +0100 |
| commit | 8c8c410f0eb7b6995c6e8db613228d91191f4e23 (patch) | |
| tree | 8a0ff8bf95e20963a40332bc5fb2588fd9eb6ba6 /asciifarm/client/display/window.py | |
| parent | d983e275f3f4ba156e33d00e5deaa2f730695cae (diff) | |
chat now works!
Diffstat (limited to 'asciifarm/client/display/window.py')
| -rw-r--r-- | asciifarm/client/display/window.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/asciifarm/client/display/window.py b/asciifarm/client/display/window.py new file mode 100644 index 0000000..bae7797 --- /dev/null +++ b/asciifarm/client/display/window.py @@ -0,0 +1,40 @@ + + + +class Window: + """ Small wrapper around curses windows """ + + def __init__(self, win, colours=False): + + self.setWin(win) + self.colours = colours + + + + def setWin(self, win): + self.win = win + + def getSize(self): + if not self.win: + return (0, 0) + height, width = self.win.getmaxyx() + return (width, height) + + def getPos(self): + if not self.win: + return (0, 0) + y, x = win.getparyx() + return (x, y) + + def addString(self, pos, string, colour=(0,0)): + x, y = pos + if self.colours: + self.win.addstr(y, x, string, self.colours.get(colour)) + else: + self.win.addstr(y, x, string) + + def erase(self): + self.win.erase() + + + |
