Previous topic

support

Next topic

widget

variable

Contains Tkinter Variable subclasses for List and Dict variables.

This module exists to supplement the built-in Tkinter Variable types, which do not provide list and dict equivalents.

class ListVar(master=None, items=None)

A tk Variable suitable for associating with Listboxes.

Create a ListVar with a given master and initial list of items.

append(item)

Append an item to the list.

count()

Return the number of items in the list.

get()

Get the entire list of values.

index(value)

Return the index of the given value.

insert(index, item)

Insert an item into the list at the specified index.

pop(index=-1)

Pop an item off the list and return it.

remove(item)

Remove the item from the list, if it exists.

set(new_list)

Set the entire list of values.

class DictVar(master=None, keys=None, values=None)

A tk Variable for storing a dictionary of values.

Create a DictVar with a given master and initial keys/values.

get()

Return the entire dictionary of keys/values as an Odict.

pop(key)

Pop the item at the given key, and return it.

set(new_dict)

Set the entire dictionary of keys/values. If new_dict is empty, or is not a dict or Odict, an empty dict is used.