qwidget

PyQt6: Removing ALL padding around widget

PyQt6: Removing ALL padding around widget Question: I’m trying push two QLineEdit-widgets all the way up to each other, but no matter how and when i call setContentsMargins(0,0,0,0) , it just does not seem to remove all margins. I’ve tried googling, but all comments just say "use layout.setContentsMargins(0,0,0,0)", and that’s it. Can somebody explain to …

Total answers: 1

QWebEngineView.page().runJavaScript() does not run a JavaScript code correctly

QWebEngineView.page().runJavaScript() does not run a JavaScript code correctly Question: I am making a Python program using PyQt5 GUI library. I found out that using runJavaScript() method does not work for executing JavaScript code on my HTML document. Here is my HTML document – a Mapbox GL JS component. It can also be found here: https://docs.mapbox.com/mapbox-gl-js/example/simple-map/ …

Total answers: 1

PyQt5 : QMovie is truncated even after resizing

PyQt5 : QMovie is truncated even after resizing Question: I am adding a gif to my QMainWindow. I want the size of my window to match exactly the size of QMovie but my QMovie is truncated at the first place and even if use resize on that, its still not showing fully. Here is the …

Total answers: 1

PyQt5: How to click a button to start the paint?

PyQt5: How to click a button to start the paint? Question: The following code makes a button and a rectangle. I would like to change it, so that the rectangle is drawn when the button is clicked. from PyQt5.QtWidgets import QWidget, QApplication, QPushButton from PyQt5.QtGui import QPainter, QColor, QBrush import sys class Example(QWidget): def __init__(self): …

Total answers: 2

PyQt: when are widgets with parents deleted?

PyQt: when are widgets with parents deleted? Question: Let’s assume I want to create a dialog box, a child of my main program: from PyQt4 import QtGui, QtCore class WizardJournal(QtGui.QDialog): def __init__(self, parent): super(WizardJournal, self).__init__(parent) self.parent = parent self.initUI() def initUI(self): self.parent.wizard = QtGui.QWidget() self.ok_button = QtGui.QPushButton("OK", self) self.vbox_global = QtGui.QVBoxLayout(self) self.vbox_global.addWidget(self.ok_button) self.paret.wizard.setLayout(self.vbox_global) self.parent.wizard.show() if …

Total answers: 1