1

Вот функция при нажатии на кнопку:

console1 = scrolledtext.ScrolledText(
    master = main_frame,
    wrap   = WORD,
    width  = 50,
    height = 12,
    state = 'disabled'
)

def sender_start():
    console1.configure(state='normal')
    console1.insert('end', 'Some Text\r\n')
    console1.configure(state='disabled')

Как сделать, чтобы при добавлении текста скролл спускался вниз?

1 ответ 1

1

Добавьте в функцию sender_start метод see. Из документации

Makes sure a given position is visible. If the index isn’t visible, scroll the view as necessary.

Т.е. с помощью данного метода мы убеждаемся, что указанная позиция видна на экране, в противном случае, будет автоматически осуществлён скролл до нужной позиции. В вашем случае нужно указать позицию end.

def sender_start():
    console1.configure(state='normal')
    console1.insert('end', 'Some Text\r\n')
    console1.configure(state='disabled')
    console1.see("end")

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.