2

I'm developing a GUI program in python which is essentially just a webpage within a QT dialog. I was wondering whether it was possible to remove the title bar because it looks horrible. So far, I have this:

app = QtGui.QApplication([])
view = QtWebKit.QWebView()

class MyWebPage(QtWebKit.QWebPage):
def acceptNavigationRequest(self, frame, req, nav_type):
    if nav_type == QtWebKit.QWebPage.NavigationTypeFormSubmitted:
        text = "<br/>\n".join(["%s: %s" % pair for pair in req.url().queryItems()])
        view.setHtml(text)
        return False
    else:
        return super(MyWebPage, self).acceptNavigationRequest(frame, req, nav_type)
view.setPage(MyWebPage())

html = """
<h1>Hello World!</h1>
"""

view.setHtml(html)

view.show()
app.exec_()

I tried the instructions Here, but it's returning the error "error: widget not definied"

Thanks.

Community
  • 1
  • 1
user2330561
  • 493
  • 2
  • 7
  • 11

1 Answers1

5

You can remove the title bar with the Window flags:

view.setWindowFlags(Qt.FramelessWindowHint)

If you want to keep a frame to resize your widget, for example, you should use:

view.setWindowFlags(Qt.CustomizeWindowHint)
Dimitry Ernot
  • 6,256
  • 2
  • 25
  • 37