diff --git a/debug.py b/debug.py index 458aff0..3d6bcd8 100644 --- a/debug.py +++ b/debug.py @@ -2,7 +2,7 @@ import magictk import random from multiprocessing import Process if __name__ == "__main__": - win = magictk.Window() + win = magictk.Window(h=400) # win = magictk.Container(mwin, h=10000, container_h=500) frame = magictk.Frame(win) @@ -20,6 +20,21 @@ if __name__ == "__main__": func=lambda s: print("Btn 6")).pack(side='left') frame.pack() + frame10 = magictk.Frame(win) + magictk.ButtonLight(frame10, text="Plain", + func=lambda s: print("Btn 2")).pack(side='left') + magictk.ButtonLight(frame10, color_type="primary", text="Primary", + func=lambda s: print("Btn 2")).pack(side='left') + magictk.ButtonLight(frame10, color_type="success", text="Success", + func=lambda s: print("Btn 3")).pack(side='left') + magictk.ButtonLight(frame10, color_type="info", text="Info", + func=lambda s: print("Btn 4")).pack(side='left') + magictk.ButtonLight(frame10, color_type="warning", text="Warning", + func=lambda s: print("Btn 5")).pack(side='left') + magictk.ButtonLight(frame10, color_type="danger", text="Danger", + func=lambda s: print("Btn 6")).pack(side='left') + frame10.pack() + frame2 = magictk.Frame(win) magictk.Select(frame2, text="Select", items=[ f"Option {i}" for i in range(1, 6)]).pack(side='left') diff --git a/magictk/__init__.py b/magictk/__init__.py index b8baf1a..75b9e6d 100644 --- a/magictk/__init__.py +++ b/magictk/__init__.py @@ -1,6 +1,6 @@ from magictk.window import Window from magictk.basicwindow import Tk -from magictk.button import Button, ButtonFill +from magictk.button import Button, ButtonFill, ButtonLight from magictk.progressbar import ProgressBar from magictk.checkbox import Checkbox, RadioGroup from magictk.submenu import Menu, MenuObjs diff --git a/magictk/button.py b/magictk/button.py index 5645d8a..49e2ab6 100644 --- a/magictk/button.py +++ b/magictk/button.py @@ -398,3 +398,21 @@ class ButtonFill(Button): self._color_text = "#FFFFFF" super().__init__(master=master, root_anim=root_anim, w=w, h=h, text=text, color_list=color_list, func=func, _set_defaultcolor=True, iconname=iconname, iconsize=iconsize) + + +class ButtonLight(ButtonFill): + + def __init__(self, master=None, root_anim=None, color_type="plain", w=80, h=30, text="Button", func=lambda s: print("Press"), color_list: dict = None, _dis_color=None, iconname="", iconsize=24): + if (color_list is not None): + self.color = color_list + if (_dis_color is None): + self._color_bd = "background" + self._color_bg = "background" + self._color_bg1 = "background" + self._color_fg1 = "placeholder_light" + self._color_fg = "border_light" + self._color_fg3 = "placeholder_light" + self._color_fg2 = "border_light" + self._color_text = self.color[color_type] + super().__init__(master=master, root_anim=root_anim, w=w, h=h, + text=text, color_list=color_list, func=func, _dis_color=True, iconname=iconname, iconsize=iconsize) diff --git a/magictk/color_tmpl.py b/magictk/color_tmpl.py index 60c9a0a..bd40e89 100644 --- a/magictk/color_tmpl.py +++ b/magictk/color_tmpl.py @@ -26,6 +26,7 @@ default_color = { "info_light2": "#F4F4F5", "info_light3": "#B1B3B8", "info_dark": "#73767A", + "plain": "#606266", "primary_text": "#303133", "regular_text": "#606266", "secondary_text": "#909399", diff --git a/setup.py b/setup.py index dd43c77..8120701 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os from setuptools import setup ####### config ####### -VERSION = "1.0.0" +VERSION = "1.0.1" ###################### set_v = VERSION