Last active
March 13, 2020 08:37
-
-
Save louisswarren/b2e6f47ea68e9f42ec67489f64332bff to your computer and use it in GitHub Desktop.
Spite in python
This file contains hidden or 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
import curses | |
SPADE, HEART, DIAMOND, CLUB = '♠♥♦♣' | |
BOX = { | |
'light': ('┌───┐', | |
'│ │', | |
'│ │', | |
'└───┘'), | |
'heavy': ('┏━━━┓', | |
'┃ ┃', | |
'┃ ┃', | |
'┗━━━┛'), | |
'double': ('╔═══╗', | |
'║ ║', | |
'║ ║', | |
'╚═══╝'), | |
'dashed': ('┌┄┄┄┐', | |
'┊ ┊', | |
'┊ ┊', | |
'└┄┄┄┘'), | |
'rounddashed': ('╭┄┄┄╮', | |
'┊ ┊', | |
'┊ ┊', | |
'╰┄┄┄╯'), | |
} | |
def draw_box(shade, win, y=0, x=0): | |
for line in BOX[shade]: | |
win.insstr(y, x, line) | |
y += 1 | |
''' | |
┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ | |
│░░░│ │ │ │ │ │ │ │ │ | |
│░░░│ │ │ │ │ │ │ │ │ | |
└───┘ └───┘ └───┘ └───┘ └───┘ | |
┄┄┄┄┄┄┄┄┄┄┄┬┄┄┄┄┄┬┄┄┄┄┄┄┄┄┄┄┄ | |
┌───┐ ┌───┐┊┌───┐┊┌───┐ ┌───┐ | |
│ │ │ │┊│ │┊│ │ │ │ | |
│ │ │ │┊│ │┊│ │ │ │ | |
└───┘ └───┘┊└───┘┊└───┘ └───┘ | |
┄┄┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┄┄ | |
┌───┐ ┌───┐┊┌───┐┊┌───┐ ┌───┐ | |
│ │ │ │┊│███│┊│ │ │ │ | |
│ │ │ │┊│███│┊│ │ │ │ | |
└───┘ └───┘┊└───┘┊└───┘ └───┘ | |
┄┄┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┄┄ | |
┌───┐ ┌───┐┊┌───┐┊┌───┐ ┌───┐ | |
│ │ │ │┊│ │┊│ │ │ │ | |
│ │ │ │┊│ │┊│ │ │ │ | |
└───┘ └───┘┊└───┘┊└───┘ └───┘ | |
┄┄┄┄┄┄┄┄┄┄┄┴┄┄┄┄┄┴┄┄┄┄┄┄┄┄┄┄┄ | |
┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ | |
│ │ │ │ │ │ │ │ │ │ | |
│ │ │ │ │ │ │ │ │ │ | |
└───┘ └───┘ └───┘ └───┘ └───┘ | |
┌┄┄┄┐ | |
┊ ┊ | |
┊ ┊ | |
└┄┄┄┘ | |
╔═══╗ | |
║ ║ | |
║ ║ | |
╚═══╝ | |
┏━━━┓ | |
┃ ┃ | |
┃ ┃ | |
┗━━━┛ | |
╭┄┄┄╮ | |
┊ ┊ | |
┊ ┊ | |
╰┄┄┄╯ | |
''' | |
def main(stdscr): | |
curses.curs_set(False) | |
w = curses.newwin(4, 5, 0, 0) | |
w2 = curses.newwin(4, 5, 0, 5) | |
draw_box('light', w) | |
draw_box('dashed', w2) | |
w.refresh() | |
w2.refresh() | |
w.getkey() | |
stdscr.getkey() | |
if __name__ == '__main__': | |
curses.wrapper(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment