pyqt4: how to see QWebPage?

I am new at QT, found some code that do what I need (some web-browsing things), it uses QWebPage to get get pages, but it does not make windows to see it. I tried to use example from Russian wiki (it works):

import sys

from PyQt4.QtGui import *
application = QApplication(sys.argv)

widget = QWidget()

widget.resize(320, 240)
widget.setWindowTitle("Hello, World!")  
widget.show()

sys.exit(application.exec_()) 

And this points: QWebPage inherit QObject, QObject inherit QWidget

but for

browser = QWebPage()
browser.show()

I get AttributeError: 'QWebPage' object has no attribute 'show'

Answers


QObject inherits QWidget

No, It doesn't - QWidget inherits QObject, not the other way around. QWebPage is just a data object. You need a QWebView which inherits QWidget and is the widget used for displaying QWebPages:

browser = QWebView()
browser.show()

Need Your Help

Edit database outside Django ORM

python django git postgresql

If one is using Django, what happens with changes made directly to the database (in my case postgres) through either pgadmin or psql?