Skip to content

Commit

Permalink
python compatibility fix
Browse files Browse the repository at this point in the history
  • Loading branch information
baskiton committed Mar 1, 2024
1 parent ceab6ec commit 721e320
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions SatsDecoder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, master, vals):

self.flags = {}

f = font.nametofont('TkDefaultFont', self)
f = tk_nametofont('TkDefaultFont', self)
w = 0
for k, v in vals.items():
x = ''
Expand All @@ -60,7 +60,7 @@ def __init__(self, master, vals):
self.configure(xscrollcommand=self.hsb.set)

def fill(self, tlm, fw_max=10):
f = font.nametofont('TkDefaultFont', self)
f = tk_nametofont('TkDefaultFont', self)
for k, v in tlm.items():
if k.startswith('flags'):
fw_max = self.fill(v, fw_max)
Expand Down Expand Up @@ -108,6 +108,14 @@ def bytes2hex(data):
return data.hex(*((' ',) if sys.version_info >= (3, 8, 0) else ()))


def tk_nametofont(name, root=None):
"""
Override `tk.font.nametofont`
in python<3.10 `root` keyword is not exist
"""
return font.Font(name=name, exists=True, root=root)


seqs_map = {
'\x72\x73\x32\x30\x73': 'aHR0cHM6Ly91cGxvYWQud2lraW1lZGlhLm9yZy93aWtpcGVkaWEvY29tbW9u'
'cy90aHVtYi80LzRhL0N1YmVTYXRfR2Vvc2Nhbi1FZGVsdmVpc19lbWJsZW0u'
Expand Down

0 comments on commit 721e320

Please sign in to comment.