How can I run pyqt5 on my Mac with M1chip (ppc64el architecture)?

After hours of trial and error, I was finally able to solve this. My successful configuration is: Open terminal with Rosetta 2 (https://dev.to/courier/tips-and-tricks-to-setup-your-apple-m1-for-development-547g) Use non-homebrew python (mine was in /usr/bin/python3) to create virtual environment /usr/bin/python3 -m venv env source env/bin/activate Upgrade pip pip install –upgrade pip Install PyQt5 pip install PyQt5

PyQt4 to PyQt5 -> mainFrame() deprecated, need fix to load web pages

you must call the QWebEnginePage::toHtml() inside the definition of the class. QWebEnginePage::toHtml() takes a pointer function or a lambda as a parameter, and this pointer function must in turn take a parameter of ‘str’ type (this is the parameter that contains the page’s html). Here is sample code below. import bs4 as bs import sys … Read more

Connect to serial from a PyQt GUI

Instead of using pySerial + thread it is better to use QSerialPort that is made to live with the Qt event-loop: from PyQt5 import QtCore, QtWidgets, QtSerialPort class Widget(QtWidgets.QWidget): def __init__(self, parent=None): super(Widget, self).__init__(parent) self.message_le = QtWidgets.QLineEdit() self.send_btn = QtWidgets.QPushButton( text=”Send”, clicked=self.send ) self.output_te = QtWidgets.QTextEdit(readOnly=True) self.button = QtWidgets.QPushButton( text=”Connect”, checkable=True, toggled=self.on_toggled ) lay = … Read more

Make QLabel clickable

I do not understand why you pass QMouseEvent to the parent constructor, you must pass the parent attribute as shown below: class QLabel_alterada(QLabel): clicked=pyqtSignal() def mousePressEvent(self, ev): self.clicked.emit() To avoid having problems with imports we can directly promote the widget as shown below: We place a QLabel and right click and choose Promote to …: … Read more

Cannot import QtWebKitWidgets in PyQt5

QtWebKit got deprecated upstream in Qt 5.5 and removed in 5.6. You may want to switch to PyQt5.QtWebEngineWidgets.QWebEngineView. For basic use of PyQt5.QtWebKitWidgets.QWebView, it can simply be updated to use PyQt5.QtWebEngineWidgets.QWebEngineView in the source code, but there may be some differences in the new component which require further adjustments.

clicked.connect() Error

The connect() method expects a callable argument. When you write self.Soft_Memory() you are making a call to that method, and the result of that call (None, since you don’t explicitly return anything) is what is being passed to connect(). You want to pass a reference to the method itself. self.PB1.clicked.connect(self.Soft_Memory)

How to change UI in same window using PyQt5?

You have to use a QStackedWidget import os import sys from PyQt5 import QtCore, QtGui, QtWidgets, uic ui_folder = os.path.join(“frontend”, “ui”) about_company_ui, _ = uic.loadUiType(os.path.join(ui_folder, “about_company.ui”)) intern_placement_ui, _ = uic.loadUiType(os.path.join(ui_folder, “intern_placement.ui”)) class InternPlacement(QtWidgets.QMainWindow, intern_placement_ui): def __init__(self, parent=None): super(InternPlacement, self).__init__(parent) self.setupUi(self) class AboutCompany(QtWidgets.QMainWindow, about_company_ui): def __init__(self, parent=None): super(AboutCompany, self).__init__(parent) self.setupUi(self) if __name__ == “__main__”: app = … Read more