Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. def __add_components(self):
  2. # canvas
  3. self.canvas = tk.Canvas(self.root, bg='lightgrey', width=450, height=450, bd=0, highlightthickness=0)
  4. self.canvas.bind('<Button-1>', self.click_canvas)
  5. self.canvas.place(x=130, y=12)
  6.  
  7. # start button
  8. self.start_button = tk.Button(self.root, command=self.begin_game, bg="lightgrey", fg="black", font="叶根友毛笔行书2.0版 15 bold", text="开始")
  9. self.start_button.place(x=35, y=100)
  10.  
  11. # Tip button
  12. self.tip_button = tk.Button(self.root, command=self.pause_sys, bg="lightgrey", fg="black", font="叶根友毛笔行书2.0版 15 bold", text="暂停")
  13. self.tip_button.place(x=35, y=160)
  14.  
  15. # end button
  16. self.exit_button = tk.Button(self.root, command=self.tip, bg="lightgrey", fg="black", font="叶根友毛笔行书2.0版 15 bold", text="提示")
  17. self.exit_button.place(x=35, y=220)
  18.  
  19. # resort button
  20. self.resort_button = tk.Button(self.root, command=self.resort, bg="lightgrey", fg="black", font="叶根友毛笔行书2.0版 15 bold", text="重排")
  21. self.resort_button.place(x=35, y=280)
  22.  
  23. # score show
  24. self.show_score = tk.Label(self.root, bg="lightgrey", fg="red", font="叶根友毛笔行书2.0版 15 bold", text=f"分数n{self.__score}")
  25. self.show_score.place(x=35, y=20)
  26.  
  27. if self.level_ or self.base_ is True:
  28. # time cartoon
  29. self.time_counter = tk.Canvas(self.root, width=22, height=180, bg="yellow")
  30. self.time_counter.place(x=615, y=80)
  31.  
  32. # time show
  33. self.show_time = tk.Label(self.root, bg="lightgrey", fg="purple", font="叶根友毛笔行书2.0版 15 bold", text=f"剩余时间n{self.__time}s")
  34. self.show_time.place(x=590, y=20)
  35.  
  36. def begin_game(self):
  37. # segment picture
  38. self.extract_small_icon_list()
  39. # init map
  40. self.init_map()
  41. # link picture and map
  42. self.draw_map()
  43. self.__game_start = True
  44. if self.level_ or self.base_ is True:
  45. self.counter()
  46. self.start_button.configure(state=tk.DISABLED)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement