更新buttonlight对应文字按钮
Build and Publish / Run (push) Successful in 56s Details

This commit is contained in:
cxykevin 2024-04-27 13:39:33 +08:00
parent c9fe20dc78
commit 8887f47359
5 changed files with 37 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import magictk
import random import random
from multiprocessing import Process from multiprocessing import Process
if __name__ == "__main__": if __name__ == "__main__":
win = magictk.Window() win = magictk.Window(h=400)
# win = magictk.Container(mwin, h=10000, container_h=500) # win = magictk.Container(mwin, h=10000, container_h=500)
frame = magictk.Frame(win) frame = magictk.Frame(win)
@ -20,6 +20,21 @@ if __name__ == "__main__":
func=lambda s: print("Btn 6")).pack(side='left') func=lambda s: print("Btn 6")).pack(side='left')
frame.pack() 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) frame2 = magictk.Frame(win)
magictk.Select(frame2, text="Select", items=[ magictk.Select(frame2, text="Select", items=[
f"Option {i}" for i in range(1, 6)]).pack(side='left') f"Option {i}" for i in range(1, 6)]).pack(side='left')

View File

@ -1,6 +1,6 @@
from magictk.window import Window from magictk.window import Window
from magictk.basicwindow import Tk 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.progressbar import ProgressBar
from magictk.checkbox import Checkbox, RadioGroup from magictk.checkbox import Checkbox, RadioGroup
from magictk.submenu import Menu, MenuObjs from magictk.submenu import Menu, MenuObjs

View File

@ -398,3 +398,21 @@ class ButtonFill(Button):
self._color_text = "#FFFFFF" self._color_text = "#FFFFFF"
super().__init__(master=master, root_anim=root_anim, w=w, h=h, 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) 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)

View File

@ -26,6 +26,7 @@ default_color = {
"info_light2": "#F4F4F5", "info_light2": "#F4F4F5",
"info_light3": "#B1B3B8", "info_light3": "#B1B3B8",
"info_dark": "#73767A", "info_dark": "#73767A",
"plain": "#606266",
"primary_text": "#303133", "primary_text": "#303133",
"regular_text": "#606266", "regular_text": "#606266",
"secondary_text": "#909399", "secondary_text": "#909399",

View File

@ -3,7 +3,7 @@ import os
from setuptools import setup from setuptools import setup
####### config ####### ####### config #######
VERSION = "1.0.0" VERSION = "1.0.1"
###################### ######################
set_v = VERSION set_v = VERSION