Skip to content

Instantly share code, notes, and snippets.

@kmonaghan
Created February 26, 2019 12:45
Show Gist options
  • Save kmonaghan/3516df4029da109354eee9730bfceddc to your computer and use it in GitHub Desktop.
Save kmonaghan/3516df4029da109354eee9730bfceddc to your computer and use it in GitHub Desktop.
# Make sure 'arial10x10.png' is in the same directory as this script.
import tcod
import tcod.event
# Setup the font.
tcod.console_set_custom_font(
"arial10x10.png",
tcod.FONT_LAYOUT_TCOD | tcod.FONT_TYPE_GREYSCALE,
)
# Initialize the root console in a context.
with tcod.console_init_root(80, 60, order="F") as root_console:
root_console.print(x=0, y=0, string='Hello World!')
unicode_string = u"\033[1;33mHello \033[0;0mworld"
print(unicode_string)
root_console.print(x=0, y=1, string=unicode_string)
while True:
tcod.console_flush() # Show the console.
for event in tcod.event.wait():
if event.type == "QUIT":
raise SystemExit()
# The libtcod window will be closed at the end of this with-block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment