This simple and no-cost alternative to the 8-Ball is fun to use. It does have it's bugs though (the cancel button does not work). Keep in mind that this is a work in progress. Have fun!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
from tkinter import messagebox | |
from tkinter import simpledialog | |
from random import randint | |
# Create the main window | |
root = tk.Tk() | |
root.geometry("300x200") | |
# Function to display a message box | |
def show_message(): | |
question = simpledialog.askstring("Question", "What is your question?") | |
random = ["Yes", "No", "Maybe", "It's Definite!", "For Sure!", "NO", "Ummm.... No"] | |
randinteger = randint(0, 6) | |
messagebox.showinfo("8-Ball's Verdict", random[randinteger]) | |
# Button to trigger the message box | |
show_message() | |
# Run the application | |
root.mainloop() | |