maliang.toolbox.utility¶
字数 366 个 代码 57 行 阅读时间 2 分钟 访问量
源代码:maliang/toolbox/utility.py
Some useful utility classes or utility functions.
🟢Trigger
¶
class
public
| object
It can only be triggered once before the reset, and multiple triggers are invalid. When triggered, the callback function is called.
command
: the function that is called when triggered
🟡get
¶
method
public
🟡lock
¶
method
public
🟡reset
¶
method
public
🟡unlock
¶
method
public
🟡update
¶
method
public
value
: updated valueargs
: args of the commandkwargs
: kwargs of the command
🔵create_smoke
¶
function
public
enhanced.PhotoImage
. size
: size of the smoke zonecolor
: color of the smoke zone
This function need PIL
to run.
About the “smoke”, see: https://fluent2.microsoft.design/material#smoke
🔵embed_window
¶
function
public
window
: Widget that will be embedded inparent
: parent widget,None
indicates that the parent widget is the screenfocus
: whether direct input focus to this window
🔵fix_cursor
¶
function
public
name
: name of cursor
🔵get_parent
¶
function
public
tkinter.Widget
. widget
: the widget
🔵get_text_size
¶
function
public
text
: the textfontsize
: font size of the textfamily
: font family of the textpadding
: extra padding of the sizemaster
: default canvas or widget providedkwargs
: kwargs oftkinter.font.Font
This function only works when the fontsize is negative number!
🔵load_font
¶
function
public
font_path
available to the font system, and return True
if the operation succeeds, False
otherwise. font_path
: the font file pathprivate
: if True, other processes cannot see this font(Only Windows OS), and this font will be unloaded when the process diesenumerable
: if True, this font will appear when enumerating fonts(Only Windows OS)
This function only works on Windows and Linux OS.
This function is referenced from customtkinter.FontManager.load_font
, CustomTkinter: TomSchimansky/CustomTkinter.
🔵screen_size
¶
function
public