|
| 1 | +import sys |
| 2 | +import os |
| 3 | +import tkinter as tk |
| 4 | +from tkinter import messagebox |
| 5 | +import random |
| 6 | + |
| 7 | +# ========================= |
| 8 | +# THEME |
| 9 | +# ========================= |
| 10 | +APP_BG = "#121212" |
| 11 | +PANEL_BG = "#1F1F1F" |
| 12 | +BTN_BG = "#2C2C2C" |
| 13 | +ACCENT = "#FF6F61" |
| 14 | +TEXT_CLR = "#E0E0E0" |
| 15 | +SUBTEXT_CLR = "#AAAAAA" |
| 16 | +INPUT_BG = "#333333" |
| 17 | +INPUT_FG = "#FFFFFF" |
| 18 | + |
| 19 | +FONT = ("Segoe UI", 11) |
| 20 | + |
| 21 | +# ========================= |
| 22 | +# APP |
| 23 | +# ========================= |
| 24 | +class RandomStoryTitleApp: |
| 25 | + def __init__(self, root): |
| 26 | + self.root = root |
| 27 | + root.title("MateTools – Random Story Title Generator") |
| 28 | + root.geometry("1000x580") |
| 29 | + root.configure(bg=APP_BG) |
| 30 | + root.resizable(False, False) |
| 31 | + |
| 32 | + # ========================= |
| 33 | + # LEFT PANEL |
| 34 | + # ========================= |
| 35 | + left = tk.Frame(root, bg=PANEL_BG, width=420) |
| 36 | + left.pack(side="left", fill="y") |
| 37 | + |
| 38 | + header = tk.Frame(left, bg=PANEL_BG) |
| 39 | + header.pack(fill="x", padx=16, pady=(18, 10)) |
| 40 | + |
| 41 | + tk.Label( |
| 42 | + header, |
| 43 | + text="MateTools", |
| 44 | + bg=PANEL_BG, |
| 45 | + fg=ACCENT, |
| 46 | + font=("Segoe UI", 20, "bold") |
| 47 | + ).pack(side="left") |
| 48 | + |
| 49 | + tk.Frame(left, bg=ACCENT, height=2).pack(fill="x", padx=16, pady=(0, 14)) |
| 50 | + |
| 51 | + tk.Label( |
| 52 | + left, |
| 53 | + text="Random Story Title Generator", |
| 54 | + bg=PANEL_BG, |
| 55 | + fg=TEXT_CLR, |
| 56 | + font=("Segoe UI", 14, "bold") |
| 57 | + ).pack(anchor="w", padx=16, pady=(0, 2)) |
| 58 | + |
| 59 | + tk.Label( |
| 60 | + left, |
| 61 | + text="Generate epic fantasy or modern thriller titles", |
| 62 | + bg=PANEL_BG, |
| 63 | + fg=SUBTEXT_CLR, |
| 64 | + font=("Segoe UI", 10) |
| 65 | + ).pack(anchor="w", padx=16, pady=(0, 16)) |
| 66 | + |
| 67 | + tk.Frame(left, bg=BTN_BG, height=1).pack(fill="x", padx=16, pady=(0, 16)) |
| 68 | + |
| 69 | + # ========================= |
| 70 | + # STYLE SELECTION |
| 71 | + # ========================= |
| 72 | + tk.Label(left, text="Select Style:", bg=PANEL_BG, fg=TEXT_CLR, font=FONT).pack(anchor="w", padx=16, pady=(0,4)) |
| 73 | + self.style_var = tk.StringVar(value="Epic Fantasy") |
| 74 | + style_menu = tk.OptionMenu(left, self.style_var, "Epic Fantasy", "Modern Thriller") |
| 75 | + style_menu.config(bg=BTN_BG, fg="white", relief="flat", font=FONT, width=40) |
| 76 | + style_menu["menu"].config(bg=PANEL_BG, fg=TEXT_CLR) |
| 77 | + style_menu.pack(anchor="w", padx=16, pady=(0,16)) |
| 78 | + |
| 79 | + # ========================= |
| 80 | + # BUTTONS |
| 81 | + # ========================= |
| 82 | + btn_frame = tk.Frame(left, bg=PANEL_BG) |
| 83 | + btn_frame.pack(fill="x", padx=16, pady=16) |
| 84 | + |
| 85 | + def make_btn(text, cmd, color=BTN_BG): |
| 86 | + return tk.Button( |
| 87 | + btn_frame, |
| 88 | + text=text, |
| 89 | + command=cmd, |
| 90 | + bg=color, |
| 91 | + fg="white", |
| 92 | + font=("Segoe UI", 11, "bold"), |
| 93 | + relief="flat", |
| 94 | + height=2, |
| 95 | + width=20 |
| 96 | + ) |
| 97 | + |
| 98 | + make_btn("Generate Story Title", self.generate_title, ACCENT).pack(side="top", pady=8) |
| 99 | + make_btn("Copy Title", self.copy_title, BTN_BG).pack(side="top", pady=8) |
| 100 | + make_btn("About", self.show_about, BTN_BG).pack(side="top", pady=20) |
| 101 | + |
| 102 | + # ========================= |
| 103 | + # RIGHT PANEL |
| 104 | + # ========================= |
| 105 | + right = tk.Frame(root, bg=APP_BG) |
| 106 | + right.pack(side="right", fill="both", expand=True) |
| 107 | + |
| 108 | + self.result_card = tk.Frame(right, bg=PANEL_BG) |
| 109 | + self.result_card.pack(padx=30, pady=40, fill="both", expand=True) |
| 110 | + |
| 111 | + tk.Label( |
| 112 | + self.result_card, |
| 113 | + text="Generated Title", |
| 114 | + bg=PANEL_BG, |
| 115 | + fg=TEXT_CLR, |
| 116 | + font=("Segoe UI", 16, "bold") |
| 117 | + ).pack(pady=(20, 10)) |
| 118 | + |
| 119 | + self.title_label = tk.Label( |
| 120 | + self.result_card, |
| 121 | + text="--", |
| 122 | + bg=PANEL_BG, |
| 123 | + fg=ACCENT, |
| 124 | + font=("Segoe UI", 18, "bold"), |
| 125 | + wraplength=500, |
| 126 | + justify="center" |
| 127 | + ) |
| 128 | + self.title_label.pack(pady=40) |
| 129 | + |
| 130 | + # Store current title |
| 131 | + self.current_title = "" |
| 132 | + |
| 133 | + # ========================= |
| 134 | + # WORD POOLS FOR STYLES |
| 135 | + # ========================= |
| 136 | + self.word_pools = { |
| 137 | + "Epic Fantasy": { |
| 138 | + "adjectives": [ |
| 139 | + "Lost", "Hidden", "Dark", "Silent", "Mysterious", "Forgotten", "Enchanted", |
| 140 | + "Shimmering", "Forsaken", "Crimson", "Eternal", "Haunted", "Sacred", "Cursed", |
| 141 | + "Glorious", "Majestic", "Fallen", "Infinite", "Broken", "Burning", "Whispering", |
| 142 | + "Frozen", "Twisted", "Radiant", "Ancient", "Lonely", "Stormy", "Golden", "Silver", |
| 143 | + "Bleak", "Wild", "Secret", "Vengeful", "Peaceful", "Sinister", "Veiled", |
| 144 | + "Shattered", "Celestial", "Arcane", "Luminous", "Obsidian", "Fading" |
| 145 | + ], |
| 146 | + "nouns": [ |
| 147 | + "Kingdom", "Forest", "Legacy", "Prophecy", "Journey", "Secret", "Night", "Treasure", |
| 148 | + "Empire", "Dragon", "Coven", "Throne", "Labyrinth", "Moon", "Star", "Crown", "Shadow", |
| 149 | + "Sword", "Flame", "Horizon", "Temple", "River", "Tower", "City", "Sea", "Island", |
| 150 | + "Mountain", "Valley", "Garden", "Catacomb", "Scroll", "Book", "Key", "Mirror", |
| 151 | + "Portal", "Beacon", "Oath", "Revelation", "Curse", "Blessing", "Chamber", "Legend" |
| 152 | + ], |
| 153 | + "actions": [ |
| 154 | + "Awakens", "Rises", "Falls", "Returns", "Hides", "Whispers", "Shines", "Calls", |
| 155 | + "Beckons", "Slumbers", "Fades", "Burns", "Echoes", "Dances", "Cries", "Summons", |
| 156 | + "Dreams", "Flees", "Blooms", "Shatters", "Reigns", "Hunts", "Glows", "Drifts", |
| 157 | + "Wanders", "Bleeds", "Spreads", "Roars", "Shimmers", "Forges", "Breaks" |
| 158 | + ] |
| 159 | + }, |
| 160 | + "Modern Thriller": { |
| 161 | + "adjectives": [ |
| 162 | + "Cold", "Silent", "Deadly", "Hidden", "Dark", "Criminal", "Dangerous", "Lost", |
| 163 | + "Vanishing", "Suspicious", "Shadowy", "Secret", "Twisted", "Final", "Unknown", |
| 164 | + "Fractured", "Broken", "Relentless", "Urgent", "Fierce", "Fatal", "Urgent" |
| 165 | + ], |
| 166 | + "nouns": [ |
| 167 | + "File", "Case", "Witness", "City", "Night", "Agent", "Truth", "Secret", |
| 168 | + "Evidence", "Shadow", "Crime", "Code", "Law", "Network", "Target", "Enemy", |
| 169 | + "Conspiracy", "Identity", "Report", "Mystery" |
| 170 | + ], |
| 171 | + "actions": [ |
| 172 | + "Hunts", "Flees", "Exposes", "Catches", "Chases", "Unfolds", "Reveals", |
| 173 | + "Escapes", "Targets", "Stalks", "Warns", "Fights", "Tracks", "Breaks", |
| 174 | + "Confronts", "Shadows" |
| 175 | + ] |
| 176 | + } |
| 177 | + } |
| 178 | + |
| 179 | + # ========================= |
| 180 | + # METHODS |
| 181 | + # ========================= |
| 182 | + def generate_title(self): |
| 183 | + style = self.style_var.get() |
| 184 | + pool = self.word_pools[style] |
| 185 | + |
| 186 | + # Randomly choose 1–2 adjectives |
| 187 | + adjectives = random.sample(pool["adjectives"], random.choice([1, 2])) |
| 188 | + # Randomly choose 1–2 nouns |
| 189 | + nouns = random.sample(pool["nouns"], random.choice([1, 2])) |
| 190 | + # Randomly choose 1–2 actions |
| 191 | + actions = random.sample(pool["actions"], random.choice([1, 2])) |
| 192 | + |
| 193 | + self.current_title = "The " + " ".join(adjectives + nouns + actions) |
| 194 | + self.title_label.config(text=self.current_title) |
| 195 | + |
| 196 | + def copy_title(self): |
| 197 | + self.root.clipboard_clear() |
| 198 | + self.root.clipboard_append(self.current_title) |
| 199 | + messagebox.showinfo("Copied", f"'{self.current_title}' copied to clipboard!") |
| 200 | + |
| 201 | + def show_about(self): |
| 202 | + messagebox.showinfo( |
| 203 | + "About", |
| 204 | + "MateTools – Random Story Title Generator\n\n" |
| 205 | + "• Generate epic fantasy or modern thriller titles\n" |
| 206 | + "• Titles now have 4–6 words for realism\n" |
| 207 | + "• Copy titles to clipboard\n\n" |
| 208 | + "Built by MateTools" |
| 209 | + ) |
| 210 | + |
| 211 | +# ========================= |
| 212 | +# RUN |
| 213 | +# ========================= |
| 214 | +if __name__ == "__main__": |
| 215 | + root = tk.Tk() |
| 216 | + RandomStoryTitleApp(root) |
| 217 | + root.mainloop() |
0 commit comments