curses game boards made simple-ish
You cannot 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 9599b73a81 update documentation 1 year ago update documentation 1 year ago rearranged and filled out colors 3 years ago an interactive example of Ouija 1 year ago


curses game boards made simple-ish

interactive example

run and follow the directions to adjust the board

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"])

style the board, as desired

default boxes look like this:

| ok! |

use the style() method to change the look (defaults shown):
        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)