Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def WordCount(FileSelection):
- WrdCount=0
- for line in ReadFile:
- Words=line.split()
- WrdCount=WrdCount+lens(Words)
- return WrdCount
- def E_Mode():
- GameInitiationButton.config(state=NORMAL)
- global DifficultyState
- DifficultyState = "Easy"
- def H_Mode():
- GameInitiationButton.config(state=NORMAL)
- global DifficultyState
- DifficultyState = "Hard"
- def GameStage01():
- global GameStage01Button
- HardModeButton.destroy()
- EasyModeButton.destroy()
- GameInitiationButton.destroy()
- SelectTextLabel.destroy()
- SelectButton=Button(root, text='Select File', bg="grey1", fg="snow", font="consolas 9", command=GameStage02, height=1, width=30)
- SelectButton.place(relx=0.5, rely=0.7, anchor='c')
- GameStage01Button = Button(root, text='Initiate Game!', bg="grey1", fg="snow", font="consolas 9", command=GameStage_E_H, state=DISABLED, height=1, width=30)
- GameStage01Button.place(relx=0.5, rely=0.85, anchor='c')
- def GameStage02():
- global FileSelection
- global ReadFile
- global WordCount
- FileSelection = filedialog.askopenfilename(filetypes=(("*.txt files", ".txt"),("*.txt files", "")))
- SelectTextLabel.destroy()
- with open(FileSelection, 'r') as file:
- for line in file:
- WordCount = line.split()
- print(WordCount)
- GameStage01Button.config(state=NORMAL)
- #
- # GameStage03_E()
- def GameStage_E_H():
- if DifficultyState == "Easy":
- GameStage03_E()
- elif DifficultyState == "Hard":
- GameStage03_H()
- def GameStage03_E():
- if WordCount <= 10:
- tkinter.messagebox.showinfo("ERROR", " Insufficient Amount Of Words Within Your Text File! ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement