def set_scroll_commands(widget, hbar, vbar):
 if vbar:
  widget['yscrollcommand'] = (vbar, 'set')
  vbar['command'] = (widget, 'yview')
 if hbar:
  widget['xscrollcommand'] = (hbar, 'set')
  hbar['command'] = (widget, 'xview')
 widget.vbar = vbar
 widget.hbar = hbar

def set_scroll_commands ( widget , hbar , vbar ) : if vbar : widget [ 'yscrollcommand' ] = ( vbar , 'set' ) vbar [ 'command' ] = ( widget , 'yview' ) if hbar : widget [ 'xscrollcommand' ] = ( hbar , 'set' ) hbar [ 'command' ] = ( widget , 'xview' ) widget . vbar = vbar widget . hbar = hbar
link a scrollable widget to its scroll bars .