tkmilan.model#
Models to store complex information in unambiguous ways.
Mostly implemented as dataclasses.
Module Attributes
The supported operations to watch for a trace. |
|
The supported validation modes, to be set |
|
The supported validation modes, to be given for |
|
The supported validation action types. |
|
The supported |
|
Pixel Coordinate Logging Size. |
|
Supported image types, and corresponding loaders. |
|
Conversion between numeric positioning and |
|
The |
|
The |
|
The sticky configuration setting. |
|
Conversion between |
|
|
|
|
Classes
|
Wrap a stateful binding. |
|
Wrap a stateful global binding. |
|
Wrap a stateful tag binding for |
|
A Cardinal Point. |
|
Dynamic Widget Style Options. |
|
The direction of automatic widget layout. |
|
Event Modifier bitfield object |
|
|
|
Widget Grid Coordinates. |
|
Widget Grid Size. |
|
Widget GUI state. |
|
Information about |
|
Image Cache metadata. |
|
Repeat an action with an interval between calls. |
|
A text justification anchor. |
Common menu element class. |
|
|
Menu Element: Cascading Menu. |
|
Menu Element: Checkbox |
|
Menu Element: Label. |
|
Menu Element: Radio Button. |
Menu Element: Separator. |
|
|
|
|
Information for each |
|
Information for all |
|
Hold a size, in pixels. |
|
Rate Limit an action. |
|
Static Widget Style Options. |
|
The grid |
Common text element class. |
|
|
Text Element: An inline text span, with optional tags. |
Text Element: Line break. |
|
|
Schedule an action into the future time, cancellable. |
|
Schedule an action into the future, whenever there's nothing else to do. |
|
Configuration for each |
|
Information for each |
|
Configuration for each |
|
Hold validation settings. |
|
Hold validated state. |
|
Validation runtime information. |
|
Hold wrapped state. |
|
Reversed version of the |
|
Widget style object. |
|
Hold the dynamic state for a widget. |
|
Hold the geometry information for a widget. |
|
Hold the view information for a widget. |
|
GUI State for entire windows. |
- class tkmilan.model.Binding(widget: mixin.MixinWidget, sequence: str, *args, **kwargs)#
Bases:
MixinBindingWrap a stateful binding.
Can be enabled and disabled separately from creation. Default to starting disabled. Note that this is the opposite from the actions of the wrapped functions.
See Python documentation for bindings and events.
- Parameters:
widget (mixin.MixinWidget) – The widget to apply the binding to.
sequence (str) – The sequence to bind to. See
Tkbind documentation, not everything applies here.action – The function to call when the binding is hit.
immediate – Enable binding on creation. Defaults to
False, requiring separate activation.description – Optional description of the binding action. Useful for debugging, not used for any purpose for now.
Note
When the
actionfunction returns"break", no more actions are considered. Use this with care.See also
For the global version of this, see
BindingGlobal.- __bool__()#
Check if the binding is enabled.
Should be used as:
if binding: print('Binding is enabled') else: print('Binding is disabled')
- enable(*, warn: bool = True) None#
Enable the binding.
- Parameters:
warn (bool) – Warn about redundant operations. Enabled by default.
See also
Use
tryenableto forcewarntoFalse.
- tryenable() bool#
Try to enable the binding, don’t warn when already enabled.
Wraps
enable, withwarnforced toFalse.- Returns:
A
boolindicating if the state has changed.- Return type:
bool
- disable(*, warn: bool = True) None#
Disable the binding.
- Parameters:
warn (bool) – Warn about redundant operations. Enabled by default.
See also
Use
trydisableto forcewarntoFalse.
- class tkmilan.model.BindingGlobal(widget: mixin.MixinWidget, sequence: str, *args, **kwargs)#
Bases:
MixinBindingWrap a stateful global binding.
This is a global version of the
Bindingobject. The main difference is that thewidgetargument is ignored, the binding applies to the entire application (technically, the widget’smixin.MixinWidget.wroot(aRootWindow).The
RootWindowwill store a dictionary of sequences toBindingGlobal. This is similar tomixin.MixinWidget.binding.- Parameters:
widget (mixin.MixinWidget) – The widget to apply the binding to. This can be any widget, only the corresponding
RootWindowis considered.sequence (str) – The sequence to bind to. See
Tkbind documentation, not everything applies here.action – The function to call when the binding is hit.
immediate – Enable binding on creation. Defaults to
False, requiring separate activation.description – Optional description of the binding action. Useful for debugging, not used for any purpose for now.
Note
When the
actionfunction returns"break", no more actions are considered. Use this with care.See also
For the widget version of this, see
Binding.- __bool__()#
Check if the binding is enabled.
Should be used as:
if binding: print('Binding is enabled') else: print('Binding is disabled')
- enable(*, warn: bool = True) None#
Enable the binding.
- Parameters:
warn (bool) – Warn about redundant operations. Enabled by default.
See also
Use
tryenableto forcewarntoFalse.
- tryenable() bool#
Try to enable the binding, don’t warn when already enabled.
Wraps
enable, withwarnforced toFalse.- Returns:
A
boolindicating if the state has changed.- Return type:
bool
- disable(*, warn: bool = True) None#
Disable the binding.
- Parameters:
warn (bool) – Warn about redundant operations. Enabled by default.
See also
Use
trydisableto forcewarntoFalse.
- class tkmilan.model.BindingTag(widget: EntryMultiline, tag: str, sequence: str, *args, **kwargs)#
Bases:
MixinBindingWrap a stateful tag binding for
EntryMultiline.This is a version of the
Bindingobject which applies only to the tags inEntryMultiline.- Parameters:
widget (EntryMultiline) – The widget to apply the binding to. This can be any widget, only the corresponding
RootWindowis considered.tag (str) – The sub-widget tag where the binding applies.
sequence (str) – The sequence to bind to. See
Tkbind documentation, not everything applies here.action – The function to call when the binding is hit.
immediate – Enable binding on creation. Defaults to
False, requiring separate activation.description – Optional description of the binding action. Useful for debugging, not used for any purpose for now.
Note
When the
actionfunction returns"break", no more actions are considered. Use this with care.- __bool__()#
Check if the binding is enabled.
Should be used as:
if binding: print('Binding is enabled') else: print('Binding is disabled')
- enable(*, warn: bool = True) None#
Enable the binding.
- Parameters:
warn (bool) – Warn about redundant operations. Enabled by default.
See also
Use
tryenableto forcewarntoFalse.
- tryenable() bool#
Try to enable the binding, don’t warn when already enabled.
Wraps
enable, withwarnforced toFalse.- Returns:
A
boolindicating if the state has changed.- Return type:
bool
- disable(*, warn: bool = True) None#
Disable the binding.
- Parameters:
warn (bool) – Warn about redundant operations. Enabled by default.
See also
Use
trydisableto forcewarntoFalse.
- class tkmilan.model.CP(value)#
Bases:
EnumA Cardinal Point.
Usually, this defines an anchor point for alignment.
Corresponds neatly to the same
tkintervalues, but it’s simpler to validate as anenum.Here is a table of cardinal points, for visual reference:
- E = 'e'#
East
- N = 'n'#
North
- S = 's'#
South
- W = 'w'#
West
- center = 'center'#
Center element on the container. Not a “cardinal point” in the usual sense.
- default = None#
OS-specific cardinal point.
- class tkmilan.model.DStyle(value)#
Bases:
EnumDynamic Widget Style Options.
These objects are replaced by the corresponding values, calculated dynamically from the theme values.
See also
SStylefor static style values.- Color_BG = 2#
Normal Widgets
background- Type:
Color
- Color_BG_Selected = 4#
Selected Widgets
background- Type:
Color
- Color_FG = 1#
Normal Widgets
foreground- Type:
Color
- Color_FG_Disabled = 3#
Disabled Widgets
foreground- Type:
Color
- Font_Default = 5#
Default Font
- Type:
Font
- class tkmilan.model.Direction(value)#
Bases:
EnumThe direction of automatic widget layout.
Here is a table of direction “cardinal points”, for visual reference:
Note
This is similar to
CP, but should not be confused with it.- grid(rows: int, cols: int, amount: int | None = None, auto_fill: bool = True) Iterable[GridCoordinates]#
Generate
GridCoordinatesfor a widget grid.If the
amountof widgets to distribute is not given, this assumes the coordinates are calculated for an uniform grid (all spaces occupied).This
amountmust fit on the grid, which mean rejecting amounts of widgets that leave an entire row or column unfilled. Theauto_fillflag controls adjusting the last widget to completely fill the available space.- Parameters:
rows (int) – Number of rows on the grid
cols (int) – Number of columns on the grid
amount (int | None) – Number of widgets to distribute. Optional, defaults to having all the grid positions fulfilled.
auto_fill (bool) – Adjust the missing widgets by expanding the last one to fill the rest of the empty space. Defaults to enable.
- multiples(*amounts: int | None, amount: int | None = None) Iterable[GridCoordinates]#
Generate
GridCoordinatesfor sequence of integer amounts.amountsis a series of integers orNone(refered to as “slots”), to be distributed per row/column, depending on the direction.There can be any number of “slots”, marking a row/column as receiving the remaining widgets. The remaining widgets are distributed evenly through the existing “slots”.
If the
amountof widgets to distribute is not given, there is no support for usingNoneas amount. Another possible error is giving an amount of slots that do not evenly divide the remaining widgets.- Parameters:
amounts (int | None) – Amount of widgets per row/column.
amount (int | None) – Number of widgets to distribute. Optional.
- E = (0, 1)#
East
- N = (-1, 0)#
North
- S = (1, 0)#
South
- W = (0, -1)#
West
- class tkmilan.model.EventModifier(value)#
Bases:
EnumEvent Modifier bitfield object
Includes all supported event modifier checks.
There is no Python documentation, nor
Tkdocumentation anywhere. This list was created by trial and error.You can read some semi-official references related to this:
Note
The documentation shows the values for the OS where the documentation is built (usually Linux). The values might be different on other platforms, like Windows.
- on(event: Event) bool#
Check if the modifier is being applied in the given event.
Very useful to check if modifiers are being applied in a cross-platform manner. Use like this:
def onEvent(self, event): if EventModifier.Control.on(event): print('Pressing Control')
- Alt = 8#
The Alt key
- AltGr = 128#
The AltGr key.
On Windows, this is equivalent to Ctrl and Alt.
- CapsLock = 2#
The CapsLock lock key.
This is a lock key, can be active even if the user is not clicking any key.
- Control = 4#
The Ctrl key
- NumLock = 16#
The NumLock lock key.
This is a lock key, can be active even if the user is not clicking any key.
- ScrollLock = None#
The ScrollLock lock key.
On Linux, this might not be supported.
This is a lock key, can be active even if the user is not clicking any key.
- Shift = 1#
The Shift key
- class tkmilan.model.FileType(*args: str)#
Bases:
Tuple[str]
- class tkmilan.model.GridCoordinates(row: int, column: int, rowspan: int = 1, columnspan: int = 1)#
Bases:
objectWidget Grid Coordinates.
This includes information about widgets, even if they span more than one row or column. It should fully specify the widget grid location.
The “location string” format is the following:
R[+RS]xC[+CS]R: Row
RS: Row Span (optional, defaults to
1)C: Column
CS: Column Span (optional, defaults to
1)
- __str__()#
Convert the grid coordinates into a “location string”.
For the reverse operation, see
parse.
- columns() Iterator[int]#
Generate all grid column indexes spanned by the widget.
- dict(*, dict_factory=<class 'dict'>)#
Get this information as a dictionary.
- classmethod parse(string: str) GridCoordinates#
Parse a “location string” to a grid coordinates object.
For the reverse operation, convert the object to
str(see__str__).
- rows() Iterator[int]#
Generate all grid row indexes spanned by the widget.
- tuple(*, tuple_factory=<class 'tuple'>)#
Get this information as a tuple.
Note
The order of fields is not ideal.
- class tkmilan.model.GridSize(rows: int, columns: int)#
Bases:
objectWidget Grid Size.
This includes information about all child widgets for a
container.- tuple(*, tuple_factory=<class 'tuple'>)#
Get this information as a tuple.
- class tkmilan.model.GuiState(enabled: bool | None = None, valid: bool | None = None, readonly: bool | None = None, alternate: bool | None = None)#
Bases:
objectWidget GUI state.
This supports all possible states, not all widgets support all states.
See
GUI_STATES,mixin.MixinWidget.gstate.- isCustom() bool#
Check if this is a custom object.
Basically, returns
Truewhen this is a subclass onGuiState. Useful to detect states with slighly different semantics.
- items()#
Workaround for
dataclasses.asdictissue.This is a problem-free version of:
return dataclasses.asdict(self).items()
- classmethod new(state: GuiState) GuiState#
Create a new object with the same state.
For performance reasons, since they are readonly on the common case, the
GuiStateobjects are passed through the hierarchy by reference.If you need to make changes to a received object, create a new object using this function.
- states_tk(*, widget: Optional[mixin.MixinWidget] = None) Sequence[str]#
Calculate the
Tkstring to use with state functions.See the
statefunction.- Parameters:
widget (Optional[mixin.MixinWidget]) – Widget to validate if the generated state is consistent with supported keys. Optional.
- class tkmilan.model.GuiState_Tk(string: str, invert: bool)#
Bases:
objectInformation about
Tkstates.The states applied to the widgets are very confusing, so store all the necessary metadata here.
See
GuiState,GUI_STATES,GUI_STATES_common.Example
The examples will analyse
GUI_STATES.The simplest example is the
"readonly"element. TheTkstring isreadonly, soinvertisFalse, the semantic values match.On the other hand, for the
"enabled"element, theTkstring isdisabled, soinvertisTrue. The semantic values are inverted.- gstr() str#
Calculate the
Tkstring to obtain the value.This already takes into account the
invertparameter.See the
instatefunction.
- sstr(value: bool) str#
Calculate the
Tkstring to define thevalue.This already takes into account the
invertparameter.See the
statefunction.
- invert: bool = <dataclasses._MISSING_TYPE object>#
Is the
stringstate the opposite from its sematic value?
- string: str = <dataclasses._MISSING_TYPE object>#
The
Tkstring used in the state-releated functions.
- class tkmilan.model.ImageCache(obj: Image | None = None, fname: Path | None = None, data: bytes | None = None, dtype: str | None = None)#
Bases:
objectImage Cache metadata.
Each cached image has metadata associated with it, to be able to support lazy-loading images.
The
objpoint to the image object, the rest are metadata used to reconstruct it.- property cached: bool#
Check if the image object is cached.
- class tkmilan.model.Interval(widget: mixin.MixinWidget, action: Callable, interval: int, immediate: bool = False)#
Bases:
objectRepeat an action with an interval between calls.
Can be scheduled and unscheduled separately from creation, see the
immediateargument.Uses a
Timeoutinternally.- Parameters:
widget (mixin.MixinWidget) – The widget to apply the interval to. When in doubt, use the
wrootwidget.action (Callable) – The function to call when the interval elapses.
interval (int) – The interval time, in milliseconds. This only starts to count from the scheduling time, not the object creation, but see
immediate.immediate (bool) – Schedule interval on creation. Defaults to
False, set toTrueto schedule automatically.
See also
To run the action only once, see
Timeout.- doState_Trace(variable: var.Variable, etype: str | None) None#
“Glue” the traced variable state to this interval state.
This should be attached to the
traceas the callback function. It will change the interval state (usingreschedule/tryunschedule) based on the variable state.Considers the boolean value for the variable contents, see truth value testing documentation.
Works for all variable types, but should be restricted to
var.Boolean. If you attach a non-boolean variable type, there is a warning on debug mode.
- reschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Reschedule the interval.
If the interval is already scheduled, this resets the interval, so it starts ticking from this point. If the interval is unscheduled, it schedules it.
Either way, after
intervalmilliseconds of calling this function, the action will run.- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- schedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Schedule the interval to start ticking.
The countdown for expiration of
intervalmilliseconds starts when this function is called.Make sure the interval is not scheduled already. When in doubt, use
rescheduleinstead.- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- tryunschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None, *, force: bool = False) None#
Try cancelling the interval.
Call
unscheduleonly if the interval is already scheduled, it’s a no-op otherwise. All arguments are passed through.- Parameters:
force (bool) – Unschedule on-flight interval, if exists. Disabled by default.
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
See also
See
unschedulefor the underlying function.
- unschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None, *, force: bool = False) None#
Cancel the interval.
This cancels the interval repetion, but after calling this function, the action might still run, at most once. See
forceto control this behaviour.- Parameters:
force (bool) – Unschedule on-flight interval, if exists. Disabled by default.
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- scheduled: bool#
Scheduled State.
Checks if the interval is scheduled to repeat.
The state is one of the following:
True: Scheduled, the action will be repeated forever.False: Unscheduled, but the action might be repeated once again at most.
- class tkmilan.model.Justification(value)#
Bases:
EnumA text justification anchor.
Corresponds to neatly to the same
tkintervalues, but it’s simpler to validate as anenum.Note
Not all widgets support
NoJustify, sometimes it’s necessary to not pass thejustifyoption at all.- Center = 'center'#
Justify Center
- Left = 'left'#
Justify Left
- NoJustify = None#
OS-specific justification.
- Right = 'right'#
Justify Right
- class tkmilan.model.MenuElement#
Bases:
ABCCommon menu element class.
This is only an abstract class, a common base class for all the possible menu types.
- Parameters:
id – The menu identifier.
variable – The menu variable object. Can be
None.
- property container: bool#
Mark menu element as a single element
- class tkmilan.model.MenuElementCascade(label: str, children: Tuple[MenuElement, ...], id: str, wstate_single: bool | None = None)#
Bases:
MenuElementMenu Element: Cascading Menu.
Represents a simple label with an attached child menu. This is similar to
FrameLabelled.- Parameters:
label (str) – The menu label.
children (Tuple[MenuElement, ...]) – The child elements. Can include other
MenuElementCascade. There should be at least one child element.wstate_single (bool | None) – Mark child menu with
wstate_single. Optional, defaults to not marking it.id (str) – The menu identifier.
Note
The
labelcannot accept newlines.- property container: bool#
Mark menu element as container, with
children
- class tkmilan.model.MenuElementCheckbox(label: str, variable: var.Boolean, id: str)#
Bases:
MenuElementMenu Element: Checkbox
Represents a checkbox. The state is always boolean.
Equivalent to
Checkbox.- Parameters:
label (str) – The menu label.
variable (var.Boolean) – The variable object.
id (str) – The menu identifier.
Note
The
labelcannot accept newlines.
- class tkmilan.model.MenuElementLabel(label: str, id: str)#
Bases:
MenuElementMenu Element: Label.
Represents a simple label, can be clicked.
Equivalent to
Button(orLabel, if you do not care about events).- Parameters:
label (str) – The menu label.
id (str) – The menu identifier.
Note
The
labelcannot accept newlines.
- class tkmilan.model.MenuElementRadio(label: str, variable: var.SpecParsed[merT], value: merT, id: str)#
Bases:
MenuElement,Generic[merT]Menu Element: Radio Button.
Represents a single radio button element. Usually, a series of these are required, sharing the same variable, to set the variable between one of the values.
Equivalent to
Radio.- Parameters:
label – The menu label.
variable – The variable object.
value – The value for this particular menu.
id – The menu identifier.
- class tkmilan.model.MenuElementSeparator(id: str)#
Bases:
MenuElementMenu Element: Separator.
Represents a separator, an horizontal line.
Equivalent to
SeparatorH.- Parameters:
id (str) – The menu identifier.
- class tkmilan.model.NotebookTab(name: str, widget: mixin.ContainerWidget, image: ~tkinter.Image | None = None, extra: ~typing.Mapping[str, ~typing.Any] = <factory>, labelPosition: dataclasses.InitVar[typing.Union[ForwardRef('CP'), bool, NoneType]] = CP.E)#
Bases:
objectInformation for each
Notebooktab.These are the parameters which can be configured:
- Parameters:
name (str) – The visible text on the tab itself
widget (mixin.ContainerWidget) – The widget corresponding to the tab. Must be a
container.image (Image | None) – Show an icon on the tab. Optional.
extra (Mapping[str, Any]) – more arguments to the
addfunction. This is an escape hatch, optional.labelPosition (dataclasses.InitVar[Union[ForwardRef('CP'), bool, NoneType]]) –
When the “image” is set, adjust the label position. When set to
CP.default, only the image is included and no label is shown.Defaults to
CP.E, not available on the object.
There are other parameters which are automatically calculated:
- Parameters:
identifier – The internal tab identifier. Set by the widget itself.
imageCompound – The
compoundsettings. Based on “labelPosition”, automatically calculated.
Note
Technically, it is possible to have
single widgetsas “widget”, but this results in broken layouts.- property tk_idx: str#
Get the
Tkindex to be used on upstream functions as needed.This uniquely identifies the correct tab.
- class tkmilan.model.NotebookTabOrder(shown: Iterable[str], *, disabled: Iterable[str] | None = None)#
Bases:
objectInformation for all
Notebooktab ordering.These are the parameters which can be configured:
- Parameters:
shown (Sequence[str]) – Tab identiers to be shown, either on normal and disable modes. Mandatory.
disabled (Set[str]) – Tab identifiers to be shown as disabled. Optional, defaults to an empy set.
Other parameters are automatically calculated:
active: Tab identifiers to be show as active.
- tk_states(allidx: Iterable[str]) Iterator[Tuple[str, int | None, Literal['normal', 'disabled', 'hidden']]]#
Generate
Tkinformation about allNotebookTab.Given all the possible tab identifiers, generate tuples with the following information:
idx: TheNotebookTabidentifierindex: The index to move theNotebookTabto.Noneif the tab should be hidden.state: TheNotebookTabstate to be configured. SeeNotebookTabStateT.
- Parameters:
allidx (Iterable[str]) – All
NotebookTabidentifiers.
- class tkmilan.model.PixelSize(w: int, h: int)#
Bases:
objectHold a size, in pixels.
- Parameters:
w (int) – Width.
h (int) – Height.
- tuple(*, tuple_factory=<class 'tuple'>)#
Get this information as a tuple.
- property aspect_ratio: Fraction#
Calculate the aspect ratio for the size.
There is no loss of precision.
- class tkmilan.model.RateLimiter(widget: mixin.MixinWidget, action: Callable, limit: int)#
Bases:
objectRate Limit an action.
Define an action and a time limit. No matter how often you
hitthis object, the time between actions is never less than thelimit(in milliseconds).It’s ready to use automatically, there’s no need to “schedule” it, like
Timeout. Uses aTimeoutinternally.- Parameters:
widget (mixin.MixinWidget) – The widget to apply the interval to. When in doubt, use the
wrootwidget.action (Callable) – The function to rate limit.
limit (int) – The rate-limit, in milliseconds. The
actionfunction is called at most once every this time.
- cancel(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Cancel the next action execution.
This cancels an action execution, when one is pending.
Be advised, this means a triggered action WILL NOT RUN. When used for event processing, means events will be lost. Make sure you know what you are doing.
- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- hit(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) bool#
Mark the action as “active”.
When this function is called, the action may or may not run, depending on the last time it ran. If the rate limit is respected, the action runs, otherwise it will wait at least the
limittime. Calling this function again before the limit is elapsed will reset the timer.- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- Returns:
If the action ran this time, return
True, otherwise returnFalse.- Return type:
bool
- class tkmilan.model.SStyle#
Bases:
objectStatic Widget Style Options.
These objects are just common values, useful in several locations. They must be calculated once, but used everywhere.
See also
DStylefor static style values.Note
This is technically a class, but should not be instanced, it only matters to join all values in a single logical location.
- classmethod items()#
Get a list of names and values.
Similar to
dict.items. Mostly useful for debug.
- Font_Button_Small: str = 'TkSmallCaptionFont'#
Font for making a
Buttonas small as possible.This will keep the button somewhat visible.
See also
Size_PadButton_Small.- Type:
Font
- Size_PadButton_Small: str = '-1'#
paddingfor making aButtonas small as possible.This will keep the button somewhat visible.
See
Font_Button_Small.- Type:
Size
- Size_PadTooltip_X: int = 5#
paddingforTooltipadjustment on the X axis.This will add a small gap between the widget and the tooltip, for positions
CP.WorCP.E.- Type:
Size
- Size_PadWidget_FrameSeparator: int = 8#
paddingwith the same size as a frame separator (e.g.FrameLabelled,FrameStateful,FrameRadio).When stacking a
FrameRadioand aRadiobutton vertically, pad theRadiowidget on the left side and align it to the left, to obtain alignedRadiowidgets.- Type:
Size
- Size_TreeHeader_Height: int = 23#
Common
heightfor theTreeheader.Useful to force the height of widgets located “inside” the header.
- Type:
Size
- Size_Window_OOBDelta: Tuple[int, int, int, int] = (0, 0, 0, 0)#
Window Out-of-Bounds adjustment delta.
These are static adjustments, heuristics based on regular OS uses.
See
fn.window_center.- Type:
Size
- Size_YF_Frame: int = -19#
yfor insetting a frame in a complex frame.Works for
FrameLabelledand friends:FrameStateful,FrameRadio, etc.- Type:
Size
- class tkmilan.model.Sticky(N: bool = False, S: bool = False, E: bool = False, W: bool = False)#
Bases:
objectThe grid
stickyconfiguration.This defines the sticky configuration for grid settings. Each of the cardinal points can be “stuck” independently. If no cardinal point is “stuck”, the widget will be centered.
There is no Python documentation, see
Tkgrid configure sticky documentation.Note
This is just the model object. See the global
Sclass for usage.- classmethod fromtk(string: str) Sticky#
Gather
Stickyconfiguration from aTkstring.- Parameters:
string (str) – The string to process,
Tkstickyconfiguration.
See also
This is the reverse of the
tk_stickyfunction.
- classmethod fromwidget(widget: Widget | Tk) Sticky | None#
Gather
Stickyconfiguration from a widget object.
- property tk_sticky: str#
Calculate the “grid sticky string”.
This is mostly used on
Tkfunctions.
- class tkmilan.model.TextElement#
Bases:
ABCCommon text element class.
This is only an abstract class, a common base class for all the possible text elements.
- class tkmilan.model.TextElementInline(text: str, tag: str | None = None, tags: ~typing.Sequence[str] | None = None, data: ~typing.Mapping[str, str] = <factory>)#
Bases:
TextElementText Element: An inline text span, with optional tags.
This is the most basic text element, just some inline string. It can optionally define one main tag, and other secondary tags to apply to the text.
- Parameters:
text (str) – The string of text. Mandatory
tag (str | None) – The main tag for the text. Optional.
tags (Sequence[str] | None) – A list of secondary tags. Optional.
data (Mapping[str, str]) – A dictionary of
data-*attributes. Default to an empty dictionary.
Note
Setting secondary tags without a main tag is invalid.
- property atags#
Get all tags defined in the element.
- class tkmilan.model.TextElement_br#
Bases:
TextElementText Element: Line break.
This is equivalent to a
TextElementInlinewith"\n"as text.
- class tkmilan.model.Timeout(widget: mixin.MixinWidget, action: Callable, timeout: int, immediate: bool = True)#
Bases:
objectSchedule an action into the future time, cancellable.
The
timeoutargument (also inschedule) acts as a deadline, after which theactionis invoked.Can be scheduled and unscheduled separately from creation, see the
immediateargument.See
Tclafter documentation.- Parameters:
widget (mixin.MixinWidget) – The widget to apply the timeout to. When in doubt, use the
wrootwidget.action (Callable) – The function to call when the timeout expires.
timeout (int) – The expiration time for the timeout, in milliseconds. This only starts to count from the scheduling time, not the object creation, but see
immediate.immediate (bool) – Schedule timeout on creation. Defaults to
True, set toFalseto schedule separately.
See also
For the idling version of this, see
TimeoutIdle.- isScheduled() bool#
Check if the timeout is scheduled to run in the future.
This is
Trueafter callingschedule, and before the action runs.
- isTriggered() bool#
Check if the timeout has been triggered yet.
This is
Truejust before the action runs. Note thatisScheduledwill returnFalsein this case.
- reschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None, *, timeout: int | None = None) None#
Reschedule the timeout (alias for
schedule).
- schedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None, *, timeout: int | None = None) None#
Schedule the timeout to run in the future.
This tries to unschedule the timeout, and schedules it again, to avoid possible race conditions. The countdown for the expiration in
timeoutmilliseconds starts when this function is called.Note the override values only take effect in this particular call, they are not permanent changes.
- Parameters:
timeout (int | None) – Override the timeout to consider on the next call.
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- toggle(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) bool#
Toggle the schedule state.
- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- Returns:
Return the new state, equivalent to calling
isScheduledright afterwards.- Return type:
bool
- unschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Cancel the timeout.
- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- class tkmilan.model.TimeoutIdle(widget: mixin.MixinWidget, action: Callable, immediate: bool = True)#
Bases:
objectSchedule an action into the future, whenever there’s nothing else to do.
This adds an idle task to the
tkevent loop, to be invoked when there’s no other action to take. This is very useful to push actions to the future, but not block the UI thread.Can be scheduled and unscheduled separately from creation, see the
immediateargument.See
tclafter idle documentation.- Parameters:
widget (mixin.MixinWidget) – The widget to apply the timeout to. When in doubt, use the
wrootwidget.action (Callable) – The function to call when the application goes idle.
immediate (bool) – Schedule timeout on creation. Defaults to
True, set toFalseto schedule separately.
See also
For a version of this that specifies a deadline, see
Timeout.- isScheduled() bool#
Check if the timeout is scheduled to run in the future.
This is
Trueafter callingschedule, and before the action runs.
- isTriggered() bool#
Check if the timeout has been triggered yet.
This is
Trueafter the action runs. Note thatisScheduledwill returnFalsein this case.Note
During the action function call, this is
False, and it will never beTrueif it callsrescheduleinside the action.
- reschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Reschedule the timeout (alias for
schedule).
- schedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Schedule the timeout to run in the future.
This tries to unschedule the timeout, and schedules it again, to avoid possible race conditions. The action is added to the event loop when this function is called.
When called for an already scheduled object, this is equivalent to moving the action back to the end of the queue.
- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- toggle(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) bool#
Toggle the schedule state.
- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- Returns:
Return the new state, equivalent to calling
isScheduledright afterwards.- Return type:
bool
- unschedule(_arg1: Any | None = None, _arg2: Any | None = None, _arg3: Any | None = None) None#
Cancel the timeout.
This removes the action from the event loop.
- Parameters:
_arg1 (Any | None) – Unused, included for API compatibility with
Tkevents_arg2 (Any | None) – Unused, included for API compatibility with
Tktraces_arg3 (Any | None) – Unused, included for API compatibility with
Tkevent loop.
- class tkmilan.model.TreeColumn(name: str, identifier: str | None = None, stretch: bool = True, image: Image | None = None, nameAnchor: CP = CP.center, cellAnchor: CP = CP.W)#
Bases:
objectConfiguration for each
tkmilan.Treecolumn.This includes settings for both the column heading, and the column cells.
There is no Python documentation, see
Tkttk.Treeview column documentation.- Parameters:
name (str) – The heading name, shown on the top of the column
identifier (str | None) – The id string. This is not shown to the user. Technically optional, but only when defining the columns, it will always have a
strin normal circumstances.stretch (bool) – Adjust the column size when resizing the widget. Defaults to
True, automatic resizes.image (Image | None) – Show an icon on the right side of the heading. Optional.
nameAnchor (CP) – Anchor the heading name to a
CP. Defaults toCP.center.cellAnchor (CP) – Anchor the body column cells to a
CP. Defaults toCP.W.
- class tkmilan.model.TreeElement(label: str, columns: Sequence[str] | None = None, children: Sequence[TreeElement] | None = None, tags: Sequence[str] | None = None, image: Image | None = None, data: Any | None = None)#
Bases:
objectInformation for each
tkmilan.Treerecord.Technically, this is not enough to reconstruct the entire tree, but it should.
The
imageargument is optional, but when created, no resizing is performed. By default, the ideal image size is16x16pixels.The
tagsinformation indicates whichTreeRowconfiguration applies.- Parameters:
label (str) – The leftmost string shown on the first column. This identifies the entire record.
columns (Sequence[str] | None) – A list of strings corresponding to the column data. Optional, defaults to
None.children (Sequence[TreeElement] | None) – A list of
TreeElement, to be shown as children of thisTreeElement. This can recurse without limit. Optional, defaults toNone.tags (Sequence[str] | None) – Record tags. Optional, defaults to an empty list.
image (Image | None) – Show an icon on the left side of the record. Optional.
data (Any) – Arbitrary data to store on the element. Optional, defaults to
None.
- class tkmilan.model.TreeRow(foreground: str | None = None, background: str | None = None, font: str | None = None, image: Image | None = None)#
Bases:
objectConfiguration for each
tkmilan.Treerow.This includes settings for each
TreeElementrecord, applied by tag.There is no Python documentation, see
Tkttk.Treeview tag options documentation.- map_tk() Mapping#
Calculate the
Tkmapping to use.There is no Python documentation, see
Tkttk.Treeview tag options documentation.
- class tkmilan.model.VSettings(postFocusIn: dataclasses.InitVar[bool] = False, postFocusOut: dataclasses.InitVar[bool] = False, preKey: dataclasses.InitVar[bool] = False, postVar: bool = True, postInitial: bool = True, fn: Callable[[VState, VWhy | None], bool | None] | None = None, fnSimple: bool = True, ttSimple: bool | None = None)#
Bases:
objectHold validation settings.
There are two types of validation, based on timing:
Pre-Validation: Validate the future state before the widget state changes. Allows for choosing whether to accept or reject the edit. Does not affect the
GuiState.This is not very common, since the UX is not very good.
Post-Validation: Validate the current widget state, and change the
GuiState. This is the most common validation.
There are also native validations (supported by
Tk), and synthetic validations, implemented inside this library.- Parameters:
postFocusIn (dataclasses.InitVar[bool]) – Post-Validate on widget getting focus. Native validation.
postFocusOut (dataclasses.InitVar[bool]) – Post-Validate on widget losing focus. Native validation.
preKey (dataclasses.InitVar[bool]) – Pre-Validate on widget getting a key event. Native validation.
postVar (bool) – Post-Validate on widget variable changing. Synthetic validation, uses
selfasValidateWhyT.postInitial (bool) – Post-Validate on widget creation. Synthetic validation, uses
initialasValidateWhyT.fn (Callable[[VState, VWhy | None], bool | None] | None) – The parsing function, to validate the state. Optional, each widget has a “natural” parsing function.
fnSimple (bool) – Do not calculate the full validation data, send only the widget state. This is usually the only thing that matters. Defaults to enabled, for performance reasons.
tt – The corresponding
Tooltipfor this widget, if available. This is paired with theputTooltipfunction. Optional, not to be used directly.ttSimple (bool | None) – When
True, setup a very simple tooltip behaviour: disable when valid, enable otherwise. Set this toFalsefor more complex behaviours. Defaults toNone, meaning dependent on other options. WhenfnisNoneorfnSimpleisFalse, default toTrue, with this the user has no way to control this. Otherwise, default toFalse.tkWhen – Calculated
Tksetting, based on the other parameters. See validation modes documentation.
- class tkmilan.model.VState(label: str, value: vsT | None = None)#
Bases:
Generic[vsT]Hold validated state.
This is needed to make sure the received object is really a validated state, or just any regular state.
- Parameters:
label – The label present on the widget.
value – The validated value. Can be
Nonewhen invalid, seevalid.
- dict(*, dict_factory=<class 'dict'>)#
Get this information as a dictionary.
- property valid: bool#
Is the validated value valid?
- class tkmilan.model.VWhy(vstate: VState, why: Literal['key', 'focusin', 'focusout', 'forced', 'initial', 'self'], t: Literal[-1, 0, 1], widget: mixin.MixinWidget, tt: Optional[Tooltip])#
Bases:
objectValidation runtime information.
There is no Python documentation, see
Tktrace validation documentation.- Parameters:
vstate (VState) – The widget validated state.
why (Literal['key', 'focusin', 'focusout', 'forced', 'initial', 'self']) –
Validation script substitution: validation condition (
%V).See
ValidateWhyT.t (Literal[-1, 0, 1]) –
Validation script substitution: action type (
%d).See
ValidateST.widget (mixin.MixinWidget) – The widget being validated.
tt (Optional[Tooltip]) –
The widget tooltip. Optional.
When this is
None, it means the automatic tooltip handling will run, and vice versa.
- validation() bool | None#
Run the natural validation for this reason.
See
mixin.MixinValidationSingle.setup_validation.
- class tkmilan.model.WState(state: wsT | None, substate: wsST)#
Bases:
Generic[wsT,wsST]Hold wrapped state.
This is needed to mark state as being a product of a wrapped container.
- dict(*, dict_factory=<class 'dict'>)#
Get this information as a dictionary.
- state: wsT | None = <dataclasses._MISSING_TYPE object>#
The widget state.
This is the extra value being stored on the widget. Optional, if the variable already exists upstream.
- substate: wsST = <dataclasses._MISSING_TYPE object>#
The wrapped state.
This is the original value being stored on the widget.
- class tkmilan.model.WStateR(state: wsT | None, substate: wsST)#
Bases:
WStateReversed version of the
WStatestate.This is exactly the same as the other object, but marks the widget state as “reversed” compared to the regular version. What that means is widget-specific, usually only required for validation.
- state: wsT | None = <dataclasses._MISSING_TYPE object>#
The widget state.
This is the extra value being stored on the widget. Optional, if the variable already exists upstream.
- substate: wsST = <dataclasses._MISSING_TYPE object>#
The wrapped state.
This is the original value being stored on the widget.
- class tkmilan.model.WStyle(_default: bool = False)#
Bases:
objectWidget style object.
This is super class of all widget-specific style objects.
All subclass arguments should be optional, with a nice-looking default value.
- Parameters:
_default (bool) – Does this represent a default value? When this is set (only for class
__init__definitions), the values can be safely overriden.
Note
Not to be confused with
tkinter.ttk.Styleobjects.
- class tkmilan.model.WidgetDynamicState(getter: Callable, setter: Callable, noneable: bool, container: bool = False)#
Bases:
objectHold the dynamic state for a widget.
See
mixin.MixinState.- Parameters:
getter (Callable) – Function to retrieve the state
setter (Callable) – Function to change the state
noneable (bool) – Is this widget noneable? See
tkmilan.mixin.MixinState.isNoneable.container (bool) – Is this widget a container? Defaults to
False.
- class tkmilan.model.WidgetGeometry(x: int, y: int, w: int | None = None, h: int | None = None)#
Bases:
objectHold the geometry information for a widget.
See the
wgeometryfunction to obtain this information from any widget.- Parameters:
x (int) – X coordinate for the widget’s topleft corner, relative to the root window
y (int) – Y coordinate for the widget’s topleft corner, relative to the root window
w (int | None) – Width of the widget. Optional, see also
handsized.h (int | None) – Height of the widget. Optional, see also
wandsized.
- tk_geometry(*, sized: bool | None = None) str#
Convert the values into a “geometry string”.
This is mostly used on
Tkfunctions.
- tuple(*, tuple_factory=<class 'tuple'>)#
Get this information as a tuple.
- property sized: bool#
Check if the object has size information
- class tkmilan.model.WidgetView(xview: Tuple[float, float] | None, yview: Tuple[float, float] | None)#
Bases:
objectHold the view information for a widget. This is important for scrollable widgets.
See the
wviewfunction to obtain this information from any widget.There is no Python documentation, see
Tkwidget xview and widget yview documentation.- Parameters:
xview (Tuple[float, float] | None) – Tuple containing the start and end fractions of the width currently visible. Optional,
Noneif the widget does not support scrolling on the X axis.yview (Tuple[float, float] | None) – Tuple containing the start and end fractions of the height currently visible. Optional,
Noneif the widget does not support scrolling on the Y axis.
- classmethod fromwidget(widget: Widget | Tk) WidgetView | None#
Gather
WidgetViewinformation from a widget object.When the
wviewfunction is not available on the widget itself, you can use this function.- Parameters:
widget (Widget | Tk) – The widget object to consider.
- Returns:
Return a
model.WidgetViewobject with the view information, if the widget supports scrolling in at least one axis. If the widget does not support scrolling, returnsNone.- Return type:
WidgetView | None
- shown(x: float | None, y: float | None) bool | None#
Check if the given fraction position is visible.
- Parameters:
x (float | None) – Fraction of width. Optional
y (float | None) – Fraction of height. Optional
- Returns:
Return
Noneif the widget does not support scrolling on the X or Y axes. Otherwise, return aboolrepresenting if bothxandyfractions are contained inxview/yview.- Return type:
bool | None
- xshown(x: float) bool | None#
Check if the given width fraction is visible.
- Parameters:
x (float) – Fraction of width.
- Returns:
Return
Noneif the widget does not support scrolling on the X axis. Otherwise, return aboolrepresenting ifxis contained inxview.- Return type:
bool | None
- yshown(y: float) bool | None#
Check if the given height fraction is visible.
- Parameters:
y (float) – Fraction of height.
- Returns:
Return
Noneif the widget does not support scrolling on the Y axis. Otherwise, return aboolrepresenting ifyis contained inyview.- Return type:
bool | None
- property deltax: float | None#
Calculate the visible width fraction.
- Returns:
Return
Noneif the widget does not support scrolling on the X axis. Otherwise return afloatrepresening the visible width fraction.
- property deltay: float | None#
Calculate the visible height fraction.
- Returns:
Return
Noneif the widget does not support scrolling on the Y axis. Otherwise return afloatrepresening the visible height fraction.
- property specced#
Check if this object is fully specced.
This indicates if scrolling on both widgets is supported.
- class tkmilan.model.WindowState(fullscreen: bool | None)#
Bases:
objectGUI State for entire windows.
This object tracks changes to attributes that apply entire windows, not individual widgets.
- Parameters:
fullscreen (bool | None) – Show the window contents on the entire screen.
See also
This is used in
RootWindow, asrgstate.- items()#
Workaround for
dataclasses.asdictissue.This is a problem-free version of:
return dataclasses.asdict(self).items()
- tkmilan.model.Alignment_CP: CP] = {(-1, -1): CP.SW, (-1, 0): CP.S, (-1, 1): CP.SE, (0, -1): CP.W, (0, 0): CP.center, (0, 1): CP.E, (1, -1): CP.NW, (1, 0): CP.N, (1, 1): CP.NE}#
Conversion between numeric positioning and
CP.The numeric positioning is an encoding of vertical and horizontal positions relative to the center, in a RTL, top-to-bottom configuration.
- tkmilan.model.CP_Compound: Mapping[CP | bool | None, str] = {CP.default: 'none', CP.N: 'bottom', CP.S: 'top', CP.E: 'left', CP.W: 'right', True: 'image', False: 'text', None: 'center'}#
The
compoundconfiguration setting.This is the mapping between
CPand thecompoundconfiguration string used in several locations.Besides the cardinal points
CP.N,CP.S,CP.E,CP.W, there are also special cases:CP.default: Show only the image if given, otherwise show only label.True: Show only the imageFalse: Show only the labelNone: Show image and label, both centered
There is no Python documentation, see
Tkcompound documentation.
- tkmilan.model.CP_S: Mapping[CP, Sticky] = {CP.N: Sticky(N=True, S=False, E=False, W=False), CP.S: Sticky(N=False, S=True, E=False, W=False), CP.E: Sticky(N=False, S=False, E=True, W=False), CP.W: Sticky(N=False, S=False, E=False, W=True), CP.NE: Sticky(N=True, S=False, E=True, W=False), CP.NW: Sticky(N=True, S=False, E=False, W=True), CP.SE: Sticky(N=False, S=True, E=True, W=False), CP.SW: Sticky(N=False, S=True, E=False, W=True), CP.center: Sticky(N=False, S=False, E=False, W=False)}#
The sticky configuration setting.
This is the mapping between
CPand the correspondingStickyobject.
- tkmilan.model.CP_ScrollAnchor: Mapping[CP, Tuple[float, float]] = {CP.N: (-0.5, 0.0), CP.S: (-0.5, -1.0), CP.E: (-1.0, -0.5), CP.W: (0.0, -0.5), CP.NE: (-1.0, 0.0), CP.NW: (0.0, 0.0), CP.SE: (-1.0, -1.0), CP.SW: (0.0, -1.0), CP.center: (-0.5, -0.5)}#
The
ScrolledWidget/Scrolledscroll anchor configuration setting.The scroll function aligns the relative coordinates to the
CP.NWcorner, this includes the adjustments necessary to support all cardinal points.See
ScrolledWidget.scrollToandScrolled.scrollTo.
- tkmilan.model.CSIZE = 4#
Pixel Coordinate Logging Size.
This is passed to
%*dto format pixel coordinates.4is a good value, since it supports coordinates until10000, that should be enough for most pratical screens.This is a global value, should remain read-only.
- tkmilan.model.GUI_STATES: Mapping[str, GuiState_Tk] = {'alternate': GuiState_Tk(string='alternate', invert=False), 'enabled': GuiState_Tk(string='disabled', invert=True), 'readonly': GuiState_Tk(string='readonly', invert=False), 'valid': GuiState_Tk(string='invalid', invert=True)}#
GuiStateTkmetadata.See
GuiState_Tk.
- tkmilan.model.GUI_STATES_common = ('enabled', 'valid')#
GuiStatecommon to all widgets.See
GUI_STATES.
- tkmilan.model.IMAGE_TYPES = {'gif': <class 'tkinter.PhotoImage'>, 'png': <class 'tkinter.PhotoImage'>}#
Supported image types, and corresponding loaders.
See
ImageCache.
- tkmilan.model.Justification_CP: Mapping[Justification, CP] = {Justification.NoJustify: CP.default, Justification.Left: CP.W, Justification.Center: CP.center, Justification.Right: CP.E}#
Conversion between
JustificationandCPobjects.This is useful to convert between types, since some widgets have weird interactions between
justifyandanchorsettings.
- tkmilan.model.NotebookTabStateT#
The supported
NotebookTabstate types.Their meanings are as follows:
normal: A regular tabdisabled: The tab is shown, but disabled. This means it cannot beselected, not even programatically.
hidden: The tab is not shown. If you show it (usingNotebook.wselect),it goes back to
normalstate.
There is no Python documentation, see
Tknotebook tab state type documentation.alias of
Literal[‘normal’, ‘disabled’, ‘hidden’]
- tkmilan.model.TraceModeT#
The supported operations to watch for a trace.
There is no Python documentation, see
Tcltrace variable documentation.alias of
Literal[‘read’, ‘write’, ‘unset’]
- tkmilan.model.ValidateST#
The supported validation action types.
Their meanings are as follows:
-1: Post-Validation. The most common usage.0: Pre-Validation: Delete1: Pre-Validation: Insert
There is no Python documentation, see
Tktrace validation action type documentation.alias of
Literal[-1, 0, 1]
- tkmilan.model.ValidateWhenT#
The supported validation modes, to be set
whenarguments.There is no Python documentation, see
Tktrace validation modes documentation.alias of
Literal[‘focus’, ‘focusin’, ‘focusout’, ‘key’, ‘all’, ‘none’]
- tkmilan.model.ValidateWhyT#
The supported validation modes, to be given for
whyarguments.Includes native and synthetic types.
There is no Python documentation, see
Tktrace validation return mode documentation.alias of
Literal[‘key’, ‘focusin’, ‘focusout’, ‘forced’, ‘initial’, ‘self’]