ae.kivy_auto_width
automatic width mix-in classes for kivy widgets
this ae portion is providing classes to mix them into any kivy widget having a texture property (like e.g.
Label or Button), to automatically size and resize widgets and/or to
display a long text as scrolling ticker within a tall widget.
automatic font size iteration with animation
mix-in the AutoFontSizeBehavior into any kivy widget with a texture property, to automatically grow or shrink
the font size to fully fill the width/height of the widget with the size of their texture.
for more details see in the documentation of the AutoFontSizeBehavior class.
automatic container width with opening animation
the mix-in-class ContainerChildrenAutoWidthBehavior determines the optimal width of a container widget,
so that the text of any children widget is fully visible/displayed.
the optimal container width is determined by increasing width of the container in iterations, which are implemented
through a kivy Animation. as soon as the texts of all children are fully displayed (or the
maximum width is reached), the animation stops.
for more details see in the documentation of the ContainerChildrenAutoWidthBehavior class.
automatic ticker animation
mix-in the SimpleAutoTickerBehavior class to automatically slide the texture of a widget if it is too big to be
completely/fully displayed, like in a news-ping-pong-ticker.
for more details check the documentation of the SimpleAutoTickerBehavior class.
Classes
|
mix-in to interpolate the optimal font size so that the texture is filling the full width of the widget. |
detect minimum width for the complete display of the textures of all children at opening with animation. |
|
|
mix-in class to slide texture in a ping-pong-like-ticker animation, if too long to be displayed completely. |
- class AutoFontSizeBehavior(**kwargs)[source]
Bases:
objectmix-in to interpolate the optimal font size so that the texture is filling the full width of the widget.
the desired spacing (left plus right) between the texture border and the widget borders can be set via the
auto_font_text_spacingproperty. additional horizontal padding can be added via the padding[0] value of the mixing-in widget.to disable the animation, set the length of the
auto_font_anim_durationto zero or very short value.the minimum and maximum of the texture font size can be restricted by setting the attributes
auto_font_min_sizeandauto_font_max_size.- auto_font_anim_duration: float
duration in seconds of the font size grow/shrink animation.
auto_font_anim_durationis aNumericPropertyand defaults to 0.9 seconds.
- auto_font_text_spacing: float
horizontal padding in pixels between widget and texture width; including the additional horizontal padding[0].
auto_font_text_spacingis aNumericPropertyand defaults to 18sp.
- auto_font_max_size: float
maximum font size.
auto_font_max_sizeis aNumericPropertyand defaults to min(MAX_FONT_SIZE,max_font_size).
- auto_font_min_size: float
minimum font size.
auto_font_min_sizeis aNumericPropertyand defaults to max(MIN_FONT_SIZE,min_font_size).
- class ContainerChildrenAutoWidthBehavior[source]
Bases:
objectdetect minimum width for the complete display of the textures of all children at opening with animation.
this mix-in class can be added to any type of container or layout widget to provide a consistent API with
open()andclose()methods, aon_complete_opened()event and acontainerattribute.Note
a container attribute will be automatically created for container classes without it.
the animation starts when the
open()method gets called. this call will be forwarded via super() to the container if it has an open method.at animation start, the width of this container will be set to the value of the
auto_width_startattribute. then the container width increases via the running animation until, either:the container width is greater than the value of the
auto_width_minimumattribute, and the textures of all children are fully visible orthe container width reaches the app window width minus the window padding specified in the
auto_width_window_paddingattribute.
the window width gets bound to the container width to ensure proper displaying if the window width changes.
- Events:
- on_complete_opened:
fired when the container width animation is finished or stopped because all children are fully visible.
- auto_width_anim_duration: float
duration in seconds of the auto-width-animation.
auto_width_anim_durationis aNumericPropertyand defaults to 0.9 seconds.
- auto_width_window_padding: float
horizontal padding in pixels between the window and the container.
auto_width_window_paddingis aNumericPropertyand defaults to 96sp.
- auto_width_minimum: float
minimum container width in pixels (before the width animation will be stopped).
auto_width_minimumis aNumericPropertyand defaults to 369sp.
- auto_width_child_padding: float
horizontal padding in pixels between child widget and child texture.
auto_width_child_paddingis aNumericPropertyand defaults to 87sp.
- auto_width_start: float
container width in pixels at the start of the width animation.
auto_width_startis aNumericPropertyand defaults to 3sp.
- __events__ = ('on_complete_opened',)
- close(*_args, **_kwargs)[source]
close/dismiss container/layout (ae.gui popup handling compatibility for all GUI frameworks).
- on_complete_opened()[source]
dispatch event default handler, called on opening when the final width got determined.
- reset_width_detection()[source]
call to reset the last detected minimum container width (e.g., if the children text got changed).
- class SimpleAutoTickerBehavior(**kwargs)[source]
Bases:
objectmix-in class to slide texture in a ping-pong-like-ticker animation, if too long to be displayed completely.
if the text or size of the widget where this class gets mixed in changes, then this instance is first determining the number of characters that can be displayed completely in this widget. this is done with a kivy animation. the duration of this animation can be set via the property
auto_ticker_length_anim_duration.to adjust the padding space between the widget border and their texture width, the property
auto_ticker_text_spacingcan be set accordingly.after determining the maximum number of characters that can be displayed and storing this value into the private attribute
_ticker_text_lengtha second animation - the offset animation - gets started to slide/scroll the text. the speed of the offset animation can be set via the propertyauto_ticker_offset_anim_speed.Note
while the ticker animations are running, the text property of the widget is only containing the visible part of the full initial text string. use the private attribute
_ori_textto determine the full-text string.- auto_ticker_length_anim_duration: float
duration in seconds of the iteration animation to determine the maximum text length.
auto_ticker_length_anim_durationis aNumericPropertyand defaults to 0.9 seconds.
- auto_ticker_minimum_text_length: int
minimum shortening text length in characters.
auto_ticker_minimum_text_lengthis aNumericPropertyand defaults to 15 chars.
- auto_ticker_offset_anim_speed: float
speed of the ticker text offset animation in characters per second.
auto_ticker_offset_anim_speedis aNumericPropertyand defaults to 9.6 chars/s.
- auto_ticker_text_spacing: float
horizontal padding between widget and texture width in pixels.
auto_ticker_text_spacingis aNumericPropertyand defaults to 18sp.