forked from WAZAAAAA0/TekkenBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI_MatchStatOverlay.py
48 lines (34 loc) · 1.73 KB
/
GUI_MatchStatOverlay.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import GUI_Overlay
from tkinter import *
from tkinter.ttk import *
from GUI_Overlay import CurrentColorScheme, ColorSchemeEnum
class TextRedirector(object):
def __init__(self, text):
self.text = text
self.text.tag_configure("center", justify="center")
def write(self, str):
if '!RECORD' in str:
self.text.configure(state="normal")
self.text.insert("1.0", '\n')
self.text.insert("1.0", str.split('|')[1], ("center",))
self.text.delete("4.0", "end")
self.text.configure(state="disabled")
self.text.see('0.0')
class GUI_MatchStatOverlay(GUI_Overlay.Overlay):
def __init__(self, master, launcher):
GUI_Overlay.Overlay.__init__(self, master, (600, 70), "Tekken Bot: Match Stats Overlay")
#self.launcher = FrameDataLauncher(self.enable_nerd_data)
self.launcher = launcher
Grid.columnconfigure(self.toplevel, 0, weight=1)
Grid.rowconfigure(self.toplevel, 0, weight=1)
self.text = self.create_textbox()
self.redirector = TextRedirector(self.text)
if not self.launcher.gameState.gameReader.flagToReacquireNames:
for record in self.launcher.cyclopedia_p1.get_matchup_record(self.launcher.gameState):
self.redirector.write(record)
def create_textbox(self):
textbox = Text(self.toplevel, width = 35, font=("Consolas, 14"), wrap=NONE, highlightthickness=0, pady=0, relief='flat')
textbox.grid(row=0, column=0, sticky=N + S + W + E)
textbox.configure(background=self.background_color)
textbox.configure(foreground=CurrentColorScheme.dict[ColorSchemeEnum.system_text])
return textbox