清理部分复杂注解保证python3.8兼容性

This commit is contained in:
cxykevin 2024-04-14 19:45:46 +08:00
parent ad0dbc33a7
commit 08669cdd1b
7 changed files with 8 additions and 29 deletions

View File

@ -75,7 +75,7 @@ class Button:
self._fill_fc[n], self._fill_hc[n])
n += 1
def __init__(self, master=None, root_anim=None, w=80, h=30, text="Button", func=lambda s: print("Press"), color_list: None | dict = None, _set_defaultcolor=None):
def __init__(self, master=None, root_anim=None, w=80, h=30, text="Button", func=lambda s: print("Press"), color_list: dict = None, _set_defaultcolor=None):
global use_font
use_font = fontconfig.getfont()
self._fill_obj = []
@ -305,7 +305,7 @@ class ButtonFill(Button):
x_n += 1
y_n += 1
def __init__(self, master=None, root_anim=None, color_type="primary", w=80, h=30, text="Button", func=lambda s: print("Press"), color_list: None | dict = None, _dis_color=None):
def __init__(self, master=None, root_anim=None, color_type="primary", w=80, h=30, text="Button", func=lambda s: print("Press"), color_list: dict = None, _dis_color=None):
if (_dis_color is None):
self._color_bd = color_type
self._color_bg = color_type

View File

@ -119,7 +119,7 @@ class Checkbox(button.ButtonFill):
self._fill_fc[n], self._fill_hc[n])
n += 1
def __init__(self, master=None, root_anim=None, color_type="primary", w=80, h=16, text="Button", color_list: None | dict = None, group: None = None):
def __init__(self, master=None, root_anim=None, color_type="primary", w=80, h=16, text="Button", color_list: dict = None, group: None = None):
global use_font
use_font = fontconfig.getfont()
self._color_bd = "border_base"
@ -129,27 +129,6 @@ class Checkbox(button.ButtonFill):
self._color_fg2 = "primary_dark"
super().__init__(master=master, root_anim=root_anim, w=w, h=h,
text=text, color_list=color_list, color_type=color_type, _dis_color=True)
# self.w = max(80, w)
# self.h = 16
# self.text = text
# self._fill_func = []
# self.__master = master
# if (color_list is not None):
# self.color = color_list
# if (root_anim == None):
# self.root = master.root
# else:
# self.root = root_anim
# self.canvas = tkinter.Canvas(
# master, bg=self.color["background"], width=self.w, height=self.h, borderwidth=0, bd=0, highlightcolor=self.color["background"], highlightthickness=0)
# self._draw()
# self.__update_color()
# self.__bind_event()
# self.bind_anim()
if (group is not None):
group._add_checkbox(self)

View File

@ -111,7 +111,7 @@ class Entry:
self.__fill_fc[n], self.__fill_hc[n])
n += 1
def __init__(self, master=None, root_anim=None, w=200, h=30, text="Input", color_list: None | dict = None, items=[]):
def __init__(self, master=None, root_anim=None, w=200, h=30, text="Input", color_list: dict = None, items=[]):
set_font()
self.input_text = ""
self.items = items

View File

@ -58,7 +58,7 @@ class ProgressBar:
x_n += 1
y_n += 1
def __init__(self, master=None, root_anim=None, w=200, h=8, colors="primary", color_list: None | dict = None):
def __init__(self, master=None, root_anim=None, w=200, h=8, colors="primary", color_list: dict = None):
self.w = max(200, w)
self.h = 8
self.__master = master

View File

@ -45,7 +45,7 @@ class Select(button.Button):
x_n += 1
y_n += 1
def __init__(self, master=None, root_anim=None, w=200, h=30, text="Select", color_list: None | dict = None, items=[]):
def __init__(self, master=None, root_anim=None, w=200, h=30, text="Select", color_list: dict = None, items=[]):
global use_font
use_font = fontconfig.getfont()
self.__arrow_json = json.loads(photoload.loadres("selectarrow"))

View File

@ -121,7 +121,7 @@ class Menu:
if (self.__closecallback is not None):
self.__closecallback(self)
def __init__(self, root, menuobj: MenuObjs, w=200, h=300, x=100, y=300, color_list: None | dict = None, closeonleave=True, fontsize=10, closecallback=None):
def __init__(self, root, menuobj: MenuObjs, w=200, h=300, x=100, y=300, color_list: dict = None, closeonleave=True, fontsize=10, closecallback=None):
global use_font
use_font = fontconfig.getfont()
self.__closecallback = closecallback

View File

@ -152,7 +152,7 @@ class Window(ttk.Frame):
titles.bind("<B1-Motion>", move_win)
titles.bind("<ButtonRelease-1>", special_move)
def __init__(self, w=500, h=350, title="MagicTk", color_list: None | dict = None) -> None:
def __init__(self, w=500, h=350, title="MagicTk", color_list: dict = None) -> None:
self.root = self
self.title = title
self.w = w