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

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?

Related

How to show a webpage in Qmainwindow?

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.

QT Webengine for Ubuntu

I have several different qt packages installed for my development environment on Ubuntu 15.04 (3.19.0-51-generic), and I can't seem to get my imports correct. The error I am running into in PyCharm is:
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: No module named 'PyQt5.QtWebEngineWidgets'
The following packages I have installed already, which I believe to be relevant are as follows:
python3-pyqt5
python3-pyqt5-dbg
python-pyqt5
python-pyqt5-dbg
pyqt5-dev-tools
pyqt5-dev
python-pyqt5.qtwebkit
python3-pyqt5.qtwebkit
python-pyqt5.qtwebkit-dbg
python3-pyqt5.qtwebkit-dbg
What am I missing here? Note that the project explicitly requires the following in its README:
Qt 5.5+
PyQt5.6+
Furthermore, I understand that webengine and webkit are two different things (I was giving it a stab). I can't find any Webengine for PyQT5 anywhere in the official Vivid repository. I tried installing libqt5webengine5-dev and libqt5webengine5 from https://launchpad.net/~ethereum/+archive/ubuntu/ethereum-qt packages with the same result, perhaps I need to add something to Python path. Can anyone lend a hand (Im normally a .NET developer :/)?

No module named xml.etree.ElementTree in GTK, python

I'm working with Python 2.7.6, Windows 8.1, in PyCharm 3.1.3.
trying to run something that already worked and get the error:
File "C:\something\sources\ParamsWin.py", line 6, in
import gtk ImportError: No module named gtk
Tried to download GTK through project settings, and got:
ImportError: No module named xml.etree.ElementTree
Tried to import element tree package and got the same error.
I've been googling quite a bit and there seems to be a problem with python and this element.
anyone, ideas?
TIA
You say you tried to download GTK?
I've had problems in the past (and the xml.etree... thing does look familiar) when I just installed GTK on its own. The best way of installing gtk in a Windows platform, in my humble opinion, is to use one of the the all-in-one downloaders from here: http://ftp.acc.umu.se/pub/GNOME/binaries/win32/pygtk/2.24/.
Cheers,
Simon

How do i import gtk module to my application? python

dialog = gtk.FileChooserDialog("Open..",
None,
gtk.FILE_CHOOSER_ACTION_OPEN,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
I want to use the above code for file browsing- but when I give the following import
import pygtk
pygtk.require('2.0')
import gtk
I get Error: No module named 'pygtk'
Do I need to give pygtk as a module inside my application folder? Do say with steps. Thank you.
pygtk is the old and deprecated gtk Python api. Do not use it unless you have a legacy application. The correct way nowadays is to use GObject-introspection to use Gtk3 from Python. Which is also really awesome as it makes Python a first-class supported language, with no wrappers necessary.
from gi.repository import Gtk
dlg = Gtk.FileChooserDialog()
dlg.show()
You should look at this: http://rox.sourceforge.net/desktop/node/245.html
It shows some problems. Good luck on fixing it :).
Edit:
This has lots of info on pip install (windows): How do I install pip on Windows?

problem with import qt in python

I want to use qt with python.
"import qt" return me :"ImportError: No module named qt". I already instaled pyqt.
what I hve to install in order to activate "import qt"
Thank You
The current PyQt comes in the PyQt4 package, which has several modules. You almost always need to start with:
from PyQt4 import QtCore
from PyQt4 import QtGui
Add other imports as necessary if you need additional sub-modules of PyQt (like QtNetwork, QtSql etc).
Tip for the future: find the lib/site-packages library of your Python installation and look at the packages in there if you're not sure about the name after installing.
Also, arm yourself with a PyQt tutorial - any decent one covers this in the first few paragraphs.
import PyQt4 works for me fine.

Categories

Resources