modFrmBot.py 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. """Фрейм для обновления статистики бота"""
  2. from typing import Dict, Any
  3. from tkinter import LabelFrame,Frame, Label, Button
  4. from pakApp.pakGui.pakWinState.modWinState import WinState
  5. class FrmBot(Frame):
  6. def __init__(self, app:Any, frmListBot:LabelFrame, name:str)->None:
  7. Frame.__init__(self, frmListBot, border=3,relief="sunken")
  8. self.pack(fill="x", side="top")
  9. self.app=app
  10. self.lblState=Label(self)
  11. self.lblState.pack(side="left")
  12. self.name=name
  13. self.btnStat=Button(self, text="Статистика",command=self.show_stat)
  14. self.btnStat.pack(side="right")
  15. def show_stat(self):
  16. print(f"FrmBot.show_Stat: name={self.name}")
  17. WinState(self.app.gui.winMain, self.name)
  18. def update_state(self, dictBot:Dict[str,str])->None:
  19. strAuto:str=dictBot["isAuto"]
  20. strIsWork:str=dictBot["isWork"]
  21. gold:str=dictBot["gold"]
  22. fuel:str=dictBot["fuel"]
  23. self.lblState["text"]="["+self.name+"] "+\
  24. "[АвтоИгра="+strAuto+"] "+\
  25. "[Работа="+strIsWork+"] "+\
  26. "[Золото="+gold+"] "+\
  27. "[Топливо="+fuel+"] "