maliang.toolbox¶
字数 11 个 阅读时间不到 1 分钟 访问量
源代码:maliang/toolbox/__init__.py
Some practical tools
模块:
-
enhanced–Enhanced versions of some tkinter classes and functions.
-
utility–Some useful utility classes or utility functions.
类:
-
PhotoImage–Pillow version of
tkinter.PhotoImage.
函数:
-
get_parent–Get the HWND of
tkinter.Widget. -
embed_window–Embed a widget into another widget.
-
load_font–Make fonts located in file
font_pathavailable to the font system, and -
screen_size–Returns the size of the screen.
-
get_text_size–Get the size of a text with a special font family and font size.
-
fix_cursor–Fix the cursor name.
-
create_smoke–Create a temporary smoke zone. Return the
enhanced.PhotoImage.
PhotoImage ¶
Bases: ImageTk.PhotoImage, tkinter.PhotoImage
Pillow version of tkinter.PhotoImage.
方法:
scale ¶
scale(x: float, y: float) -> PhotoImage
Scale the PhotoImage.
x: The x-axis scale factory: The y-axis scale factor
resize ¶
resize(width: int, height: int) -> PhotoImage
Resize the PhotoImage.
width: The new width of the imageheight: The new height of the image
get_parent ¶
Get the HWND of tkinter.Widget.
widget: the widget
embed_window ¶
Embed a widget into another widget.
window: Widget that will be embedded inparent: parent widget,Noneindicates that the parent widget is the screenfocus: whether direct input focus to this window
load_font ¶
Make fonts located in file 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.
get_text_size ¶
get_text_size(
text: str,
fontsize: int | None = None,
family: str | None = None,
*,
padding: int = 0,
master: tkinter.Canvas | virtual.Widget | None = None,
**kwargs
) -> tuple[int, int]
Get the size of a text with a special font family and font size.
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!
create_smoke ¶
create_smoke(
size: tuple[int, int], *, color: str | tuple[int, int, int, int] = "#00000066"
) -> enhanced.PhotoImage
Create a temporary smoke zone. Return the enhanced.PhotoImage.
size: size of the smoke zonecolor: color of the smoke zone
This function need PIL to run.
About the “smoke”, see: fluent2.microsoft.design/material#smoke