[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Embedding QWidgets within a parent
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2014-04-25 15:36:40
Message-ID: d1b337ae0b8103f1566003ef785fe304 () www ! riverbankcomputing ! com
[Download RAW message or body]
On 25/04/2014 1:23 pm, Chris Wood wrote:
> Hmm, I've been through that tutorial several times, and I thought I
> was getting the hang of stuff, but that tutorial doesn't seem to
> mention anywhere anything about how to set parents or children.
> However, it seems it might be easier than I thought it was - I hadn't
> realised that I could do something like:
>
> class webwidget(QtGui.QWidget):
>
> def __init__(self):
> super(webwidget, self).__init__()
>
> self.b = Browser()
> self.b.load(QUrl('http://www.google.com [7]'))
>
> self.grid = QtGui.QGridLayout()
> self.grid.addWidget(self.b,0,1)
>
> self.setLayout(self.grid)
>
> class Browser(QWebView):
>
> def __init__(self):
> QWebView.__init__(self)
> self.loadFinished.connect(self._result_available)
>
> def _result_available(self, ok):
> frame = self.page().mainFrame()
>
> and that Google now does appear in my gui! :) (n.b. is there a better
> way to do it - should I call load() somewhere else?) but, how does the
> comment about children / parents relate to this?
If that is all you are doing then why bother? QWebView is a widget
itself.
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic