#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2
    Rep Power
    0

    PyQT Autoscroll down


    Hi all.

    I'm writting my first app in python 2.3.3 & PyQt 3.8.1.

    It contains a TextBrowser component.
    I'm using this for error/information log in my app,
    Works fine, butt it doesn't scrolldown automatic

    I was searching @ google and found this in a qt mailing list:
    Code:
    QScrollBar *scrollBar = textView->verticalScrollBar();
    scrollBar->setValue(scrollBar->maxValue());
    So how do i use this in pyqt?

    TextBrowser creation:
    Code:
            self.textBrowserLog = QTextBrowser(self.groupBoxLog,"textBrowserLog")
            self.textBrowserLog.setGeometry(QRect(10,50,380,70))
            self.textBrowserLog.setTextFormat(QTextBrowser.LogText)
    python code for adding text to TextBrowser:
    Code:
        def SetLog(self, log):
            """Set Log"""
            oldlog = str(self.textBrowserLog.text())
            newlog = oldlog + str(log)
            self.textBrowserLog.setText(newlog)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    325
    Rep Power
    12
    oh yeh ... that's the prob with qt doco's
    You have to convert it to py yourself.

    Try this (for converting the code you posted)

    Code:
    scrollBar = textView.verticalScrollBar();
    scrollBar.setValue(scrollBar.maxValue());
    Tho I'm not sure that's what you want

    I do all my Qt coding using QtDesigner which is a drag and drop application. Makes it absurdly easy.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2
    Rep Power
    0

    Talking


    Originally posted by lazy_yogi
    oh yeh ... that's the prob with qt doco's
    You have to convert it to py yourself.

    Try this (for converting the code you posted)

    Code:
    scrollBar = textView.verticalScrollBar();
    scrollBar.setValue(scrollBar.maxValue());
    Tho I'm not sure that's what you want

    I do all my Qt coding using QtDesigner which is a drag and drop application. Makes it absurdly easy.
    Thank you, I will try this as soon as i have time!

IMN logo majestic logo threadwatch logo seochat tools logo