Skip to content

Instantly share code, notes, and snippets.

@louisswarren
Last active March 13, 2020 08:37
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 louisswarren/b2e6f47ea68e9f42ec67489f64332bff to your computer and use it in GitHub Desktop.
Save louisswarren/b2e6f47ea68e9f42ec67489f64332bff to your computer and use it in GitHub Desktop.
Spite in python
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