def autoscroll(sbar, first, last):
 (first, last) = (float(first), float(last))
 if ((first <= 0) and (last >= 1)):
  sbar.grid_remove()
 else:
  sbar.grid()
 sbar.set(first, last)

def autoscroll ( sbar , first , last ) : ( first , last ) = ( float ( first ) , float ( last ) ) if ( ( first <= 0 ) and ( last >= 1 ) ) : sbar . grid_remove ( ) else : sbar . grid ( ) sbar . set ( first , last )
hide and show scrollbar as needed .