maliang.core.containers¶
字数 913 个 代码 173 行 阅读时间 5 分钟 访问量
源代码:maliang/core/containers.py
All containers.
There are two containers at the window level: Tk
and Toplevel
. Tk
is generally used for the main window, while Toplevel
is a pop-up window.
There is another container at the canvas level: Canvas
. Canvas
is the main container carrier.
🟢Canvas
¶
class
public
| Canvas
Misc
The parent widget of all virtual widgets is Canvas
.
master
: parent widgetexpand
: the mode of expand,x
is horizontal, andy
is verticalauto_zoom
: whether or not to scale its items automaticallykeep_ratio
: the mode of aspect ratio,min
follows the minimum value,max
follows the maximum valuefree_anchor
: whether the anchor point is free-floatingauto_update
: whether the theme manager update it automaticallyzoom_all_items
: (Experimental) whether or not to scale its all itemskwargs
: compatible with other parameters of classtkinter.Canvas
🟡_initialization
¶
method
protected
🟡_zoom_self
¶
method
protected
Canvas
itself. 🟡_zoom_tk_widgets
¶
method
protected
rel_ratio
: the ratio of the current size to the previous size
🟡clear
¶
method
public
🟡create_text
¶
method
public
🟡destroy
¶
method
public
🟡on_click
¶
method
public
🟡on_key_press
¶
method
public
🟡on_key_release
¶
method
public
🟡on_motion
¶
method
public
🟡on_release
¶
method
public
🟡on_wheel
¶
method
public
🟡register_event
¶
method
public
name
: event name, such as ““ add
: whether it is an attached call
In general, you don’t need to call this method, but when the event to be bound is not in the predefined event, you need to manually call the method once.
🟡theme
¶
method
public
value
: theme name
🟡zoom
¶
method
public
Canvas
based on the relevant parameters. This method only works for Canvas with Place layout.
🟢Misc
¶
class
public
| ABC
🟡__enter__
¶
method
special
🟡__exit__
¶
method
special
🟡destroy
¶
method
public
🟢Tk
¶
class
public
| Tk
Misc
In general, there is only one main window. But after destroying it, another one can be created.
size
: size of the windowposition
: position of the window, based on the upper left (nw) corner. And negative numbers are based on the bottom right (se) corner.title
: title of the window, default value is"tk"
icon
: icon of the window, default value is the icon of tk**kwargs
: compatible with other parameters of classtkinter.Tk
🟡_fixed_theme
¶
method
protected
method
: the method of being decorated
🟡_wrap_method
¶
method
protected
method_name
: the name of the method to be decorated
🟡_zoom
¶
method
protected
🟡alpha
¶
method
public
value
: the transparency of the window, range is 0~1
🟡at_exit
¶
method
public
command
: the function that was calledensure_destroy
: whether the window is guaranteed to be closed
🟡center
¶
method
public
refer
: The area of the reference widget, if it is None, means that the reference area is the entire screen.
🟡destroy
¶
method
public
🟡fullscreen
¶
method
public
value
: indicate whether the window is full-screen
The method should be called at the end of the code, or after some time after the program has started.
🟡geometry
¶
method
public
size
: the size of the window, if it is None, does not change anythingposition
: the position of the window, if it is None, does not change anything
If you want to use tkinter.Tk.geometry
, please use tkinter.Tk.wm_geometry
instead.
🟡icon
¶
method
public
value
: the icon
🟡theme
¶
method
public
value
: theme nameinclude_children
: wether include its children, like Toplevelinclude_canvases
: wether include its canvases
🟡toolwindow
¶
method
public
value
: indicate whether the window is tool-window
This method only works on Windows!
🟡topmost
¶
method
public
value
: indicate whether the window is topmost
🟡transparentcolor
¶
method
public
value
: the penetration color of the window
This method only works on Windows!
🟢Toplevel
¶
class
public
| Toplevel
Tk
Misc
It can be used as a pop-up window, or it can be customized to put anything you want to show.
master
: parent widgetsize
: size of the window, default value is 960x540(px)position
: position of the window, default value indicates randomtitle
: title of window, default is the same as title of mastericon
: icon of the window, default is the same as title of mastergrab
: set grab for this windowfocus
: whether direct input focus to this window**kwargs
: compatible with other parameters of classtkinter.Toplevel
🟡destroy
¶
method
public