This repository has been archived by the owner on Dec 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
"""Simple example usage of terminaltables without any other dependencies. | ||
Just prints sample text and exits. | ||
""" | ||
|
||
from __future__ import print_function | ||
from terminaltables import AsciiTable, UnixTable | ||
|
||
|
||
table_data = [ | ||
['Platform', 'Years', 'Notes'], | ||
['Mk5', '2007-2009', 'The Golf Mk5 Variant was\nintroduced in January 2007 and\nproduced up to March 2009.'], | ||
['MKVI', '2009-2013', 'Might actually be Mk5.'], | ||
] | ||
table = AsciiTable(table_data, 'Jetta SportWagen') | ||
print() | ||
print(table.table) | ||
|
||
table = UnixTable(table_data, 'Jetta SportWagen') | ||
table.inner_row_border = True | ||
table.justify_columns[2] = 'right' | ||
print() | ||
print(table.table) | ||
|
||
table.outer_border = False | ||
table.justify_columns[1] = 'center' | ||
print() | ||
print(table.table) | ||
|
||
print() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
"""Example usage of terminaltables using colorclass. | ||
Just prints sample text and exits. | ||
""" | ||
|
||
from __future__ import print_function | ||
from colorclass import Color | ||
from terminaltables import UnixTable | ||
|
||
|
||
table_data = [ | ||
[Color('{autogreen}<10ms{/autogreen}'), '192.168.0.100, 192.168.0.101'], | ||
[Color('{autoyellow}10ms <= 100ms{/autoyellow}'), '192.168.0.102, 192.168.0.103'], | ||
[Color('{autored}>100ms{/autored}'), '192.168.0.105'], | ||
] | ||
table = UnixTable(table_data) | ||
table.inner_heading_row_border = False | ||
print() | ||
print(table.table) | ||
|
||
table.title = '192.168.0.105' | ||
table.justify_columns = {0: 'center', 1: 'center', 2: 'center'} | ||
table.inner_row_border = True | ||
table.table_data = [ | ||
[Color('Low Space'), Color('{autocyan}Nominal Space{/autocyan}'), Color('Excessive Space')], | ||
[Color('Low Load'), Color('Nominal Load'), Color('{autored}High Load{/autored}')], | ||
[Color('{autocyan}Low Free RAM{/autocyan}'), Color('Nominal Free RAM'), Color('High Free RAM')], | ||
] | ||
print() | ||
print(table.table) | ||
|
||
table.title = None | ||
table.outer_border = False | ||
table.table_data = [['A', 'B'], ['C', 'D']] | ||
print() | ||
print(table.table) | ||
|
||
table.outer_border = True | ||
table.inner_row_border = False | ||
table.inner_column_border = False | ||
print() | ||
print(table.table) | ||
|
||
table = UnixTable([['Obey Obey Obey Obey']], 'Instructions') | ||
print() | ||
print(table.table) | ||
|
||
print() |