Let’s say you’re writing a little Python project that references the Tomb of Annihilation adventure (or you just want to display a dramatic “disclaimer” message for users about risk, death, traps, etc.). You may want to programmatically show a fun, styled disclaimer at the start of your script, maybe even with logic (e.g., user must acknowledge it).
What is “Disclaimer”
When I say “Tomb of Annihilation Disclaimer”, I refer to a startup or splash message in your Python program that warns the user of risk, sets tone, maybe asks for consent much like the tongue-in-cheek official disclaimer of the Tomb of Annihilation adventure: “This adventure will make your players hate you the kind of simmering hatred that eats away at their souls until all that remains are dark little spheres of annihilation where their hearts used to be”.
In our Python project we mimic that vibe: the user is entering a dangerous adventure (your app, script, game), so we pop up a dramatic warning/disclaimer. It’s not just a legal notice; it’s part of style, atmosphere, and interaction.
Designing the Disclaimer Module:
Let’s think ahead about what our “disclaimer module” should do.
Functional Requirements
- When the Python script starts, display a disclaimer message.
- The message should be clear, stylised (to fit the Tomb of Annihilation theme).
- The user must explicitly acknowledge (e.g., press Enter or type “yes”).
- If they don’t acknowledge (e.g., exit, or enter something else), exit the script.
- Log the acknowledgment (timestamp, username maybe).
- Allow customizing the message (via config file).
- Potential support for both console and GUI display.
- Code should be reusable: e.g.,
disclaimer.pythat you import.
Code Structure
We’ll keep it simple, easy to read, easy to maintain:
disclaimer.py: definesshow_disclaimer()function and maybe aDisclaimerclass.config.jsonorconfig.yaml: allows the user to specify message text, style options, log file path.main.py: your application entry that imports the module and calls it.tests/test_disclaimer.py: simple unit tests to verify the module works as expected.
Dependencies & Environment
We’ll aim for minimal dependencies: built-in sys, time, logging, maybe json or yaml. If we do GUI, we’ll use built-in tkinter. That ensures broad compatibility.
Styling / User Experience
In console mode: use ANSI colour codes (if terminal supports). E.g., a red bold headline:
print("\033[1;31mWARNING: This adventure will …\033[0m")
Then indent message, maybe ASCII tomb or skull icon. Ask “Do you wish to continue? (yes/no):”. If yes → proceed; if no or anything else → exit.
In GUI mode (optional): show a pop-up with the text and “Accept” & “Decline” buttons
Create config.json
Here is a sample config.json you might include in your project root:
{
"disclaimer": {
"title": "Tomb of Annihilation – WARNING!",
"message": "This programme will lead you into the jungle of code and traps. Death, loss and annihilation await. Proceed only if your heart is steeled and your will unbroken.",
"prompt": "Do you accept these risks and wish to continue? (yes/no): ",
"log_file": "disclaimer_ack.log",
"use_colors": true
}
}
You can obviously adjust the wording, path, styling flag. Using JSON keeps it simple and readable.
Write disclaimer.py
Here’s a sample implementation:
import sys
import time
import json
import logging
import os
class Disclaimer:
def __init__(self, config_path="config.json"):
with open(config_path, 'r') as f:
cfg = json.load(f)
self.title = cfg["disclaimer"]["title"]
self.message = cfg["disclaimer"]["message"]
self.prompt = cfg["disclaimer"]["prompt"]
self.log_file = cfg["disclaimer"]["log_file"]
self.use_colors = cfg["disclaimer"].get("use_colors", False)
logging.basicConfig(filename=self.log_file,
level=logging.INFO,
format='%(asctime)s - %(message)s')
def _print_title(self):
if self.use_colors:
print("\033[1;31m" + self.title + "\033[0m")
else:
print(self.title)
def _print_message(self):
print(self.message)
def ask_acknowledgment(self):
self._print_title()
self._print_message()
answer = input(self.prompt).strip().lower()
if answer == 'yes':
logging.info("User accepted disclaimer.")
print("Proceeding…")
else:
logging.info("User declined disclaimer. Exiting.")
print("You chose not to proceed. Goodbye.")
time.sleep(1)
sys.exit(1)
def show_disclaimer(config_path="config.json"):
d = Disclaimer(config_path)
d.ask_acknowledgment()
- On init, we load config from
config.json. - We set up logging to the specified log file.
_print_title()and_print_message()handle displaying the message (with colours if enabled).ask_acknowledgment()prints title + message, asks prompt, checks answer. If not'yes', we exit. The logging records acceptance or decline.
Use in main.py
In your main script you simply do:
from disclaimer import show_disclaimer
def main():
show_disclaimer()
# rest of your program here
print("Welcome to the chaos of the Tomb of Annihilation…")
if __name__ == '__main__':
main()
So right at startup you force the disclaimer.
Logging & Review
Open the disclaimer_ack.log file after a run and you’ll find lines like:
2025-10-21 12:34:56,789 - User accepted disclaimer.
If user declined, you’ll see “User declined disclaimer. Exiting.”
You can later review who accepted the disclaimer (assuming you log e.g., username via os.getlogin() or getpass.getuser() if you like).
Optional GUI Mode
If you prefer a graphical pop-up rather than console, you could modify disclaimer.py to detect if the environment has a GUI and use tkinter:
try:
import tkinter as tk
from tkinter import messagebox
GUI_AVAILABLE = True
except ImportError:
GUI_AVAILABLE = False
def ask_acknowledgment_gui(self):
root = tk.Tk()
root.withdraw() # hide main window
result = messagebox.askyesno(self.title, self.message)
if result:
logging.info("User accepted disclaimer (GUI).")
else:
logging.info("User declined disclaimer (GUI).")
sys.exit(1)
root.destroy()
You might add a config flag "gui_mode": true and if both GUI_AVAILABLE and config flag true, call ask_acknowledgment_gui().
Unit Tests
You should include a simple test file, e.g., tests/test_disclaimer.py:
import unittest
import os
import tempfile
import json
from disclaimer import Disclaimer
class TestDisclaimer(unittest.TestCase):
def setUp(self):
self.tmpconfig = tempfile.NamedTemporaryFile(mode='w+', delete=False)
cfg = {
"disclaimer": {
"title": "Test Title",
"message": "Test message.",
"prompt": "Continue? (yes/no): ",
"log_file": "test.log",
"use_colors": False
}
}
json.dump(cfg, self.tmpconfig)
self.tmpconfig.close()
def tearDown(self):
os.remove(self.tmpconfig.name)
if os.path.exists("test.log"):
os.remove("test.log")
def test_init_load(self):
d = Disclaimer(config_path=self.tmpconfig.name)
self.assertEqual(d.title, "Test Title")
self.assertEqual(d.message, "Test message.")
self.assertFalse(d.use_colors)
# Additional tests: simulate input etc. Could use unittest.mock to patch input.
if __name__ == '__main__':
unittest.main()
Wrap Up
Creating a “Tomb of Annihilation Disclaimer” in Python doesn’t have to be just “print a message”. With a well designed module, you can provide a dramatic startup message, require acknowledgment, log the response, support config customization, maybe GUI mode, localization, styling all in reusable code.

