qt5

Add dropdown actions to Pyqt5 frame widget when right-click event is triggered

Add dropdown actions to Pyqt5 frame widget when right-click event is triggered Question: I have a Qframe widget and I already created an event triger like this def mousePressEvent(self, QMouseEvent): if QMouseEvent.button() == Qt.RightButton: # do what you want here print("Right Button Clicked") #showMenuAtMouseLocation() # to be implemented I want a small menu list to …

Total answers: 1

How to get good plots in Spyder python ? (Inline and Qt5)

How to get good plots in Spyder python ? (Inline and Qt5) Question: When i plot in Spyder with the Backend Qt5 in graphics ( the window that pops with the plot) i don’t get things aesthetically beautiful. The title sometimes is not showing, the labels, … All in all it is just not good …

Total answers: 2

How to solve the problem "TypeError: setEnabled(self, bool): argument 1 has unexpected type 'str'"?

How to solve the problem "TypeError: setEnabled(self, bool): argument 1 has unexpected type 'str'"? Question: I have encountered such a problem ` > python .main.py Traceback (most recent call last): File "C:main.py", line 79, in writeF self.ui.lineEdit.setEnabled(value) TypeError: setEnabled(self, bool): argument 1 has unexpected type ‘str’ ` My code is hosted on github, here’s the …

Total answers: 1

Trying to make a dark- lightmode switcher

Trying to make a dark- lightmode switcher Question: I’m trying to make a Button which switches between light and dark mode. Switching to dark mode is pretty easy, but switching to light mode again is a bit complicated. I am trying to switch to the default Palette but I don’t know how it really works. …

Total answers: 1

Remove margin around QTabWidget in python

Remove margin around QTabWidget in python Question: I am making a web browser in qt5 for fun, however there is a margin between the QTabWidget and the window, and does not look appealing. Is there any way to remove it? Here is the app class code class App(QWidget): def __init__(self) -> None: super().__init__() #self.windowTitle = …

Total answers: 1

Switching Buttons in QMessageBox

Switching Buttons in QMessageBox Question: I have this code: def initUI(self): mainLayout = QVBoxLayout() # Temporary: Dialog Testing Button # self.buttonTest = button(‘Dialog Testing’) self.buttonTest.clicked.connect(self.TestFile) mainLayout.addWidget(self.buttonTest) self.setLayout(mainLayout) # Connects to dialogTesting Button def dialogMessage(self, message): dialog = QMessageBox(self) dialog.setWindowTitle(‘Sample Text’) dialog.setText(message) dialog.show() # Connects with dialogMessage class. def TestFile(self): self.dialogMessage("When will non-OK buttons appear?") return …

Total answers: 1

Qt5 application not terminating on QMainWindow.close() after opening QFileDialog

Qt5 application not terminating on QMainWindow.close() after opening QFileDialog Question: I have a not very sophisticated but also not trivial Qt5 python application (the full thing is here: https://gitlab.com/rulrich/pydatagrab but see below for a minimal example) My question is the following: I have a QMainWindow where in the constructor I do many things, but also: …

Total answers: 1

PyQt5 move QDockWidget by dragging tab

PyQt5 move QDockWidget by dragging tab Question: The clip below shows dragging QDockWidgets between docking areas by dragging the tabs (not the title bar) – but when I try this with PyQt 5.15.0 it doesn’t work, the tabs won’t detach. How can I enable this behavior? What I want: https://www.screencast.com/t/lv83SoyVUhbd (from https://woboq.com/blog/qdockwidget-changes-in-56.html) What I get: …

Total answers: 2

How to import from Qt:: namespase (Qt5, Python3.x)?

How to import from Qt:: namespase (Qt5, Python3.x)? Question: For my application, I need to set some widget parameters like alignment (Qt::AlignBottom) and others. But I can’t import them (other PyQt5 stuff imports without any issues). Using this code from PyQt5 import Qt progressBar = QProgressBar(splash) progressBar.setAlignment(Qt.AlignBottom) I got the following error: Traceback (most recent …

Total answers: 3

Is there a tutorial specifically for PyQt5?

Is there a tutorial specifically for PyQt5? Question: I am looking for a PyQt5 tutorial. It is rather complicated to start GUI development with Python for the first time without a tutorial. I only found some PyQt4 tutorials so far, and since something changed from Qt4 to Qt5, for example the fact SIGNAL and SLOT …

Total answers: 3