문제

I am working on a chatroom client and am using an HTML window to process things like images and html tags and formatting. I am having trouble finding out how to make the scrollbar stay at the bottom as messages are added to the window (every message sends the bar to the top)

would anyone know how I would go about doing this?

도움이 되었습니까?

해결책

After you add a new message, you can call Scroll on your htmlWindow to set its scrollBar position to the end.

yourHtmlWindow.Scroll(-1, self.GetClientSize()[0])

If you want your scrollBar to stay at the bottom when the window is resized then you will need to Bind to wx.EVT_SIZE so that you can call Scroll on resize.

def onSize(self, event):
    event.Skip()
    wx.CallAfter(yourHtmlWindow.Scroll, -1, self.GetClientSize()[0])
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top