1+ from tkinter .font import Font
2+
13from ttkbootstrap import Style
24from ttkbootstrap .constants import *
35from scanner import ServerInfo
68from colorlib import Color
79from tkinter import Misc
810from typing import Any
9- from copy import copy
11+ from copy import copy , deepcopy
1012import tkinter as tk
1113import vars
1214
@@ -31,7 +33,7 @@ def __load_motd(self):
3133 for extra in self .data .description_json :
3234 try :
3335 tag = hex (randint (0 , 114514 ))
34- tag_font = ( "Unifont" , 12 )
36+ tag_font = Font ( family = "Unifont" , size = 12 )
3537 if extra .get ("color" ):
3638 if "#" not in extra ["color" ]:
3739 color = vars .color_map_hex [extra ["color" ]]
@@ -42,14 +44,11 @@ def __load_motd(self):
4244 if extra .get ("underline" ) or extra .get ("underlined" ):
4345 self .tag_configure (tag , underline = True )
4446 if extra .get ("bold" ):
45- tag_font += ("bold" ,)
46- tag_font = list (tag_font )
47- tag_font [0 ] = "宋体"
48- tag_font = tuple (tag_font )
47+ tag_font .config (family = "宋体" , weight = "bold" )
4948 elif extra .get ("italic" ):
50- tag_font += ( "italic" , )
49+ tag_font . config ( slant = "italic" )
5150 elif extra .get ("strikethrough" ):
52- tag_font += ( " overstrike" , )
51+ tag_font . config ( overstrike = True )
5352
5453 self .tag_configure (tag , font = tag_font , justify = LEFT )
5554 self .insert (END , extra ["text" ], tag )
0 commit comments