def _var(ctor, default, callback=None):
    """
    Creates a Tkinter variable, initialize it and possibly trace it.

    @param default the variable initial value
    @param callback function to invoke whenever the variable changes its value
    @return the created variable
    """
    var = ctor()
    var.set(default)
    if callback:
        var.trace('w', callback)
    return var