AutoFillContainer

class lib.gui.control_helper.AutoFillContainer(parent, initial_columns, max_columns, style='')

Bases: object

A container object that auto-fills columns.

Parameters:
  • parent (ttk.Frame) – The parent widget that holds this container

  • initial_columns (int) – The initial number of columns that this container should display

  • max_columns (int) – The maximum number of column that this container is permitted to display

  • style (str, optional) – The name of the style to use for the control panel. Styles are configured when TkInter initializes. The style name is the common prefix prior to the widget name. Default: empty string (use the OS style)

Attributes Summary

items

Returns the number of items held in this container

subframe

Returns the next sub-frame to be populated

Methods Summary

compile_widget_config()

Compile all children recursively in correct order if not already compiled and add to _widget_config

config_cleaner(widget)

Some options don't like to be copied, so this returns a cleaned configuration from a widget We use config() instead of configure() because some items (ttk Scale) do not populate configure()

destroy_children()

Destroy the currently existing widgets

get_all_children_config(widget, child_list)

Return all children, recursively, of given widget.

pack_config_cleaner(widget)

Some options don't like to be copied, so this returns a cleaned configuration from a widget

pack_widget_clones(widget_dicts[, ...])

Recursively pass through the list of widgets creating clones and packing all children.

rearrange_columns(width)

On column number change redistribute widgets

repack_columns()

Repack or unpack columns based on display columns

scale_column_width(original_size, ...)

Scale the column width based on selected font size

set_subframes()

Set a sub-frame for each possible column

validate(width)

Validate that passed in width should trigger column re-arranging

Attributes Documentation

items

Returns the number of items held in this container

subframe

Returns the next sub-frame to be populated

Methods Documentation

compile_widget_config()

Compile all children recursively in correct order if not already compiled and add to _widget_config

static config_cleaner(widget)

Some options don’t like to be copied, so this returns a cleaned configuration from a widget We use config() instead of configure() because some items (ttk Scale) do not populate configure()

destroy_children()

Destroy the currently existing widgets

get_all_children_config(widget, child_list)

Return all children, recursively, of given widget.

Parameters:
  • widget (tkinter widget) – The widget to recursively obtain the configurations of each child

  • child_list (list) – The list of child configurations already collected

Returns:

The list of configurations for all recursive children of the given widget

Return type:

list

static pack_config_cleaner(widget)

Some options don’t like to be copied, so this returns a cleaned configuration from a widget

pack_widget_clones(widget_dicts, old_children=None, new_children=None)

Recursively pass through the list of widgets creating clones and packing all children.

Widgets cannot be given a new parent so we need to clone them and then pack the new widgets.

Parameters:
  • widget_dicts (list) – List of dictionaries, in appearance order, of widget information for cloning widgets

  • old_childen (list, optional) – Used for recursion. Leave at None

  • new_childen (list, optional) – Used for recursion. Leave at None

rearrange_columns(width)

On column number change redistribute widgets

repack_columns()

Repack or unpack columns based on display columns

static scale_column_width(original_size, original_fontsize)

Scale the column width based on selected font size

set_subframes()

Set a sub-frame for each possible column

validate(width)

Validate that passed in width should trigger column re-arranging

compile_widget_config()

Compile all children recursively in correct order if not already compiled and add to _widget_config

static config_cleaner(widget)

Some options don’t like to be copied, so this returns a cleaned configuration from a widget We use config() instead of configure() because some items (ttk Scale) do not populate configure()

destroy_children()

Destroy the currently existing widgets

get_all_children_config(widget, child_list)

Return all children, recursively, of given widget.

Parameters:
  • widget (tkinter widget) – The widget to recursively obtain the configurations of each child

  • child_list (list) – The list of child configurations already collected

Returns:

The list of configurations for all recursive children of the given widget

Return type:

list

property items

Returns the number of items held in this container

static pack_config_cleaner(widget)

Some options don’t like to be copied, so this returns a cleaned configuration from a widget

pack_widget_clones(widget_dicts, old_children=None, new_children=None)

Recursively pass through the list of widgets creating clones and packing all children.

Widgets cannot be given a new parent so we need to clone them and then pack the new widgets.

Parameters:
  • widget_dicts (list) – List of dictionaries, in appearance order, of widget information for cloning widgets

  • old_childen (list, optional) – Used for recursion. Leave at None

  • new_childen (list, optional) – Used for recursion. Leave at None

rearrange_columns(width)

On column number change redistribute widgets

repack_columns()

Repack or unpack columns based on display columns

static scale_column_width(original_size, original_fontsize)

Scale the column width based on selected font size

set_subframes()

Set a sub-frame for each possible column

property subframe

Returns the next sub-frame to be populated

validate(width)

Validate that passed in width should trigger column re-arranging