curses game boards made simple-ish
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mryouse 37312c7915 rearranged and filled out colors 7 months ago
README.md add alignment logic 7 months ago
ouija.py rearranged and filled out colors 7 months ago
sample.py a more representative sample 7 months ago

README.md

ouija

curses game boards made simple-ish

how to use

set up a standard, simple curses python method, as seen in the docs

create an object with the top-left corner and the curses screen object

ouija_board = Ouija(stdscr, 3, 3)

create the possible Tiles, add them to the object

Tiles are created with the array value (the value in the board), the display value (the value to be displayed), and optionally the color

tiles = []
tiles.append(Tile("array_value_1", "display_value_1")
tiles.append(Tile("array_value_2", "display_value_2", Ouija.COLORS["RED"])
ouija_board.setup_tiles(tiles)

style the board, as desired

default boxes look like this:

:~~~~~:
| ok! |
:~~~~~:

use the style() method to change the look (defaults shown):

ouija_board.style(
        vert_edge="|",
        horiz_edge="~",
        corner=":",
        vert_pad=0,
        horiz_pad=1,
        vert_margin=0,
        horiz_margin=0,
        uniform_width=True,  # makes all boxes as big as the biggest box
        align=Ouija.Align.LEFT)  # can also align RIGHT and CENTER

create and draw a board

currently, draw_board() expects a 2D array. optionally, it takes the (y, x) coordinate of a cell to highlight.

board = [["array_value_1","array_value_2"],["array_value_2","array_value_1"]]
ouija_board.draw_board(board, 1, 1)