Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import random
- window = Tk()
- window.title("Random Story Generator v1")
- Starts = ["From the crow's nest of your ship your first mate yells down a story about ","Once there was ","Once upon a time there was ","One day while walking in the woods you encountered ","While in a plane you look out the window and see ", "While peering into a doorway to an alternate reality you witness "]
- Subject = ["a pirate ","a potato ","a magical flying octopus ","a traveling salesman ", "a sentient rock ", "a giant tuna "]
- Action = ["that stared blankly into your soul.","that was said he was your father.","that died.","that danced a merry pirate jig.","that did absolutely nothing.","that told you the secrets of the universe.", "riding a shark."]
- def Generate():
- File = open("RandomFile.txt", "w")
- random.shuffle(Starts)
- random.shuffle(Subject)
- random.shuffle(Action)
- File.write(Starts[0])
- File.write(Subject[0])
- File.write(Action[0])
- File.close()
- Story = open("RandomFile.txt", "r")
- Lines = Story.read()
- messagebox.showinfo("Story", Lines)
- Story.close()
- Button = Button(window, text = "Begin your journey", command = Generate).pack()
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement