[PyQt] QLabel.setTextInteractionFlags raises AttributeError
Hans-Peter Jansen
hpj at urpla.net
Fri Jan 18 09:57:12 GMT 2008
Am Freitag, 18. Januar 2008 schrieb Dog Walker:
> On Jan 17, 2008 3:05 PM, Phil Thompson <phil at riverbankcomputing.co.uk>
wrote:
> > On Thursday 17 January 2008, Dog Walker wrote:
> > > QT: 3.3.7 SuSE 10.2
> > >
> > > Docs (/PyQt-x11-gpl-4.1.1/doc/html/qlabel.html) show
> > > "QLabel.setTextInteractionFlags (self, Qt.TextInteractionFlags
> > > flags)"
> >
> > This is PyQt4.
>
> I guess that is what the "4.1.1" implies. Thanks.
>
> [...]
>
> What I wanted to do was make the various version information displayed
> on an About dialog selectable. I tried rich text but that isn't
> selectable either. Do I have to use some other widget in pyqt3 to get
> that effect? And which one, please?
Assuming, you're still on PyQt3, try QTextBrowser. Here's what I use:
from qt import QTextBrowser
import webbrowser
class TextBrowser(QTextBrowser):
def __init__(self, *args):
QTextBrowser.__init__(self, *args)
def setSource(self, name):
#print "TextBrowser.setSource", name
try:
browser = webbrowser.Konqueror()
browser.open(name)
success = 1
except:
success = 0
if not success:
try:
webbrowser.open(name)
except:
pass
Now, you may want to present the versions in a html table, with links to the
various projects. Cool, isn't it..
Hth,
Pete
More information about the PyQt
mailing list