You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial/part-01.rst
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ Use the code :python:`for event in tcod.event.wait():` to begin handing events.
94
94
95
95
In the event loop start with the line :python:`print(event)` so that all events can be viewed from the program output.
96
96
Then test if an event is for closing the window with :python:`if isinstance(event, tcod.event.Quit):`.
97
-
If this is True then you should exit the function with :python:`raise SystemExit()`. [#why_raise]_
97
+
If this is True then you should exit the function with :python:`raise SystemExit`. [#why_raise]_
98
98
99
99
.. code-block:: python
100
100
:emphasize-lines: 3,5,15-23
@@ -121,7 +121,7 @@ If this is True then you should exit the function with :python:`raise SystemExit
121
121
for event in tcod.event.wait(): # Event loop, blocks until pending events exist
122
122
print(event)
123
123
ifisinstance(event, tcod.event.Quit):
124
-
raiseSystemExit()
124
+
raiseSystemExit
125
125
126
126
127
127
if__name__=="__main__":
@@ -205,7 +205,7 @@ Modify the drawing routine so that the console is cleared, then passed to :pytho
205
205
for event in tcod.event.wait():
206
206
print(event)
207
207
ifisinstance(event, tcod.event.Quit):
208
-
raiseSystemExit()
208
+
raiseSystemExit
209
209
210
210
211
211
if__name__=="__main__":
@@ -259,7 +259,7 @@ The full script so far is:
259
259
"""Move the player on events and handle exiting. Movement is hard-coded."""
260
260
match event:
261
261
case tcod.event.Quit():
262
-
raiseSystemExit()
262
+
raiseSystemExit
263
263
case tcod.event.KeyDown(sym=tcod.event.KeySym.LEFT):
264
264
self.player_x -=1
265
265
case tcod.event.KeyDown(sym=tcod.event.KeySym.RIGHT):
@@ -308,5 +308,5 @@ You can review the part-1 source code `here <https://github.com/HexDecimal/pytho
308
308
.. [#init_context] This tutorial follows the setup for a fixed-size console.
309
309
The alternatives shown in :ref:`getting-started` are outside the scope of this tutorial.
310
310
311
-
.. [#why_raise] You could use :python:`return` here to exit the ``main`` function and end the program, but :python:`raise SystemExit()` is used because it will close the program from anywhere.
312
-
:python:`raise SystemExit()` is also more useful to teach than :any:`sys.exit`.
311
+
.. [#why_raise] You could use :python:`return` here to exit the ``main`` function and end the program, but :python:`raise SystemExit` is used because it will close the program from anywhere.
312
+
:python:`raise SystemExit` is also more useful to teach than :any:`sys.exit`.
0 commit comments