forked from libtcod/python-tcod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloWorld.py
More file actions
executable file
·27 lines (22 loc) · 1.01 KB
/
Copy pathhelloWorld.py
File metadata and controls
executable file
·27 lines (22 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
"""
Example showing some of the most basic functions needed to say "Hello World"
"""
# import the tdl library and all of it's functions, this gives us access to anything
# starting with "tdl."
import tdl
# start the main console, this will open the window that you see and give you a Console.
# we make a small window that's 20 tiles wide and 16 tile's tall for this example.
console = tdl.init(20, 16)
# draw the string "Hello World" at the top left corner using the default colors:
# a white forground on a black background.
console.draw_str(0, 0, 'Hello World')
# display the changes to the console with flush.
# if you forget this part the screen will stay black emptiness forever.
tdl.flush()
# wait for a key press, any key pressed now will cause the program flow to the next part
# which closes out of the program.
tdl.event.keyWait()
# if you run this example in IDLE then we'll need to delete the console manually
# otherwise IDLE prevents the window from closing causing it to hang
del console