예제 #1
0
def header_alignments():
    PROMPT.write('Header columns centered')
    PROMPT.write('')

    alignments = [ALIGN_CENTER for i in range(0, NUM_COLS)]

    table = Table(PROMPT, NUM_COLS, table_width=60, wrap_policy=WRAP_POLICY_WRAP, header_col_alignments=alignments)
    table.render(TEST_DATA, headers=TEST_HEADERS)
예제 #2
0
def colored():
    PROMPT.write('Alternating colored rows and header row colors')
    PROMPT.write('')

    table = Table(PROMPT, NUM_COLS, table_width=60, wrap_policy=WRAP_POLICY_WRAP)
    table.header_color=okaara.prompt.COLOR_BG_BLUE
    table.row_colors=[okaara.prompt.COLOR_LIGHT_BLUE, okaara.prompt.COLOR_LIGHT_PURPLE, okaara.prompt.COLOR_CYAN]

    table.render(TEST_DATA, headers=TEST_HEADERS)
예제 #3
0
def alignments():
    PROMPT.write('First column is right aligned, second center aligned, custom column widths')
    PROMPT.write('')

    alignments = [ALIGN_LEFT for i in range(0, NUM_COLS)]
    alignments[0] = ALIGN_RIGHT
    alignments[1] = ALIGN_CENTER

    widths = [20 for i in range(0, NUM_COLS)]
    widths[0] = 5

    table = Table(PROMPT, NUM_COLS, col_alignments=alignments, col_widths=widths, wrap_policy=WRAP_POLICY_WRAP)
    table.render(TEST_DATA, headers=TEST_HEADERS)
예제 #4
0
def no_headers():
    PROMPT.write('Table defaults, no header data specified')
    PROMPT.write('')

    table = Table(PROMPT, NUM_COLS)
    table.render(TEST_DATA)
예제 #5
0
def custom_formatting():
    PROMPT.write('Custom formatting for header divider and column separator')
    PROMPT.write('')

    table = Table(PROMPT, NUM_COLS, table_width=60, wrap_policy=WRAP_POLICY_WRAP, header_divider_tick='*', col_separator=' | ')
    table.render(TEST_DATA, headers=TEST_HEADERS)
예제 #6
0
def wrapped():
    PROMPT.write('Smaller table width with cell wrap policy set to wrap.')
    PROMPT.write('')

    table = Table(PROMPT, NUM_COLS, table_width=60, wrap_policy=WRAP_POLICY_WRAP)
    table.render(TEST_DATA, headers=TEST_HEADERS)
예제 #7
0
def basic():
    PROMPT.write('Table rendered using the defaults.')
    PROMPT.write('')

    table = Table(PROMPT, NUM_COLS)
    table.render(TEST_DATA, headers=TEST_HEADERS)