def widget_name(widget):
    """
  Return the widget name. Try first to get avc_name attribute. If this
  fails, get Tk widget name keeping the last part only.
  """
    try:
        return widget.avc_name
    except:
        return str(widget).split('.')[-1]
