How to show a webpage in Qmainwindow? - python

I have searched entire web to find a way to do this.
All the answers are about PyQt4, Pyside, Qwebview, Qt4, or Qt5(C++), therefore they do not work on PyQt5.
the other answer is QtWebEngineView: unknown for PyQt5 (at least mine).
I have the latest version of Python, Pycharm and PyQt5.

Tnx All. The correct import was from PyQt5 import QtWebEngineWidgetsthen, you can use QWebEngineVieweasily by load() method.

Related

PyQt5 and Wayland. A gtk-layer-shell python module for Qt5?

I have some python applications using the Qt5 libs I want to port/use under Wayland/wlroots. I have searched for documentation everywhere but I haven't found really nothing, apart about compositors. With the Gtk3 libs very useful is the module gtk-layer-shell for wlroots, but I cannot use it with a pyqt5 window, obviously.
Any suggestions?

Can't import qtlottie in qml(PyQt5)

How can I install qtlottie qml module? I'm using and PyQt5(5.15.3) and as document says it's supported since 5.13 but when I try to import it I get the following error:
I found no workaround for it searching the internet... Thanks in advance
It doesn't get installed by default. In the Qt Maintenance Tool, you need to check the box labeled Qt Lottie Animation.

No autocomplete for PyQt4 in PyCharm

On my office PC I'm using
Python 3.4
PyQt4 Version 4.11.1
PyCharm Community Eddition 3.4.1
I installed everything in the order as stated above.
However, code completion does not work. It works for imports, but not for classes and methods.
I made a small sample program:
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.setWindowTitle("Test")
window.resize(300, 200)
window.show()
sys.exit(app.exec_())
In the code above none of the classes or methods were suggested by PyCharm.
If I type window.setW I would expect it to suggest setWindowTitle() but it doesn't.
Strange thing is, that I'm using the same setup on my computer at home and there it works like a (Py)charm... Autocompletion, auto imports, etc. As far as I remember I installed it the same way as I did on my office PC.
I already looked at some similiar questions but this question has no answers and others don't contain relevant information that helped me so far.
Don't know if it is relevant but at this line
from PyQt4 import QtGui
PyCharm tells me
Unresolved reference 'QtGui'
Maybe the reason for this is the same.
I had the same problem on Linux, pyqt5 and pycharm CE.
The solution was to rebuild the skeletons with:
File > Invalidate Caches / Restart > Invalidate and Restart.
The problem was solved by installing PyCharm first and then Python and PyQt.
Afterwards I had to configure the interpreter in PyCharm and it worked.
When I posted the question I installed Python, then PyQt and then PyCharm.
Oddly enough, it worked in this order on another PC.
I went through the same issue recently. Unfortunately, the install order didn't solve it for me.
There is a bug report here. Downloading the Early Access Program release worked and can be found here

Running matplotlib with PyQt on Windows

I'm having trouble running matplotlib with PyQt on Windows 7.
When executing any code that uses these two libraries, even demo code such as: http://eli.thegreenplace.net/files/prog_code/qt_mpl_bars.py.txt
I get this error:
TypeError: 'PySide.QtGui.QWidget.setParent' called with wrong argument types:
PySide.QtGui.QWidget.setParent(QWidget)
Supported signatures:
PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget)
PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget, PySide.QtCore.Qt.WindowFl
ags)
I'm using Python 2.7.5, matplotlib 1.2.1, and PyQt 4.10.3. All of these are 32-bit, running on my 64-bit OS. I've ran code which used matplotlib and PyQt separately with no issues.
I've tried the solution suggested in Getting PySide to work with matplotlib with no success.
Please help me track down this error.
I am not clear if you want to use PySide or PyQt, but in either case the problem is you want to use one, but matplotlib is setting up the Qt4 backend using the other one, hence the confusing looking errors.
If you want to use PySide make sure
backend.qt4 : PySide # PyQt4 | PySide
is in your matplotlibrc file.
If you want to use PyQt make sure
backend.qt4 : PyQt4 # PyQt4 | PySide
is in your matplotlibrc file.

Difference between qt and PyQt4

Well I am new to Qt and found its easier to work with python , I dont know how far its true .
but some of the code snippets have
import qt
and some have
import PyQt4
I don't know what the difference is, when I tried to interchange them I did get some errors , like some function was not recognizable and so on, also I am trying to build front end GUI for my application, which GUI framework would u suggest ? Is there anything close to VB like environment ?
Old PyQt3 use qt
import qt
Current PyQt4 use PyQt4
import PyQt4
If you use PySide, use PySide
import PySide

Categories

Resources