Advertisement
Guest User

Part Of Code

a guest
Jan 1st, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. def WordCount(FileSelection):
  2. WrdCount=0
  3. for line in ReadFile:
  4. Words=line.split()
  5. WrdCount=WrdCount+lens(Words)
  6. return WrdCount
  7.  
  8. def E_Mode():
  9. GameInitiationButton.config(state=NORMAL)
  10. global DifficultyState
  11. DifficultyState = "Easy"
  12.  
  13. def H_Mode():
  14. GameInitiationButton.config(state=NORMAL)
  15. global DifficultyState
  16. DifficultyState = "Hard"
  17.  
  18. def GameStage01():
  19. global GameStage01Button
  20. HardModeButton.destroy()
  21. EasyModeButton.destroy()
  22. GameInitiationButton.destroy()
  23. SelectTextLabel.destroy()
  24. SelectButton=Button(root, text='Select File', bg="grey1", fg="snow", font="consolas 9", command=GameStage02, height=1, width=30)
  25. SelectButton.place(relx=0.5, rely=0.7, anchor='c')
  26. GameStage01Button = Button(root, text='Initiate Game!', bg="grey1", fg="snow", font="consolas 9", command=GameStage_E_H, state=DISABLED, height=1, width=30)
  27. GameStage01Button.place(relx=0.5, rely=0.85, anchor='c')
  28.  
  29. def GameStage02():
  30. global FileSelection
  31. global ReadFile
  32. global WordCount
  33. FileSelection = filedialog.askopenfilename(filetypes=(("*.txt files", ".txt"),("*.txt files", "")))
  34. SelectTextLabel.destroy()
  35. with open(FileSelection, 'r') as file:
  36. for line in file:
  37. WordCount = line.split()
  38. print(WordCount)
  39. GameStage01Button.config(state=NORMAL)
  40. #
  41. # GameStage03_E()
  42.  
  43. def GameStage_E_H():
  44. if DifficultyState == "Easy":
  45. GameStage03_E()
  46. elif DifficultyState == "Hard":
  47. GameStage03_H()
  48.  
  49.  
  50. def GameStage03_E():
  51. if WordCount <= 10:
  52. tkinter.messagebox.showinfo("ERROR", " Insufficient Amount Of Words Within Your Text File! ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement