pyqt5

Calling a function and having it call multiple times

此生再无相见时 提交于 2021-02-05 11:27:08
问题 I'm having an issue in PyQt5 where if I some of my functions, it calls it however many times I've called it so far. I'll try to water down to relevant code. class MainWindow(QtWidgets.QMainWindow, UI.MainUI.Ui_MainWindow): """The Main Window where everything happens""" def __init__(self, parent=None): """Initializes (Don't use partial as most of the variables aren't created yet)""" super(MainWindow, self).__init__(parent) self.setupUi(self) self.btn_buy_ship.clicked.connect( lambda: self.game

Cannot redirect Pyinstaller single executable output while running it in subprocess

笑着哭i 提交于 2021-02-05 11:21:06
问题 I've been struggling with this for quite a while. I've managed to write a code that can capture STDOUT of .py files, however when I run the exact same code with executable generated from Pyinstaller (doesn't matter whether it's windowed or not) the readyReadStandardOutput signal doesn't ever come up. From my tests it occurs that any signal at all is emitted only when the app crashes, however I need a live communication between the GUI and the executable. Here's my code for reference: def

How to fix buttons not showing properly using Python, PyQt5, and Pyinstaller

别等时光非礼了梦想. 提交于 2021-02-05 11:12:29
问题 I created an interface using Qt Designer and integrated it into my python code using PyQt5. I then created an exe file using Pyinstaller and the interface shows up fine on my laptop using Windows 10 Home. However testing on a different windows machine using Windows 10 Pro shows the buttons and labels all cut out , with wrong font and all as shown below. For example, the top title should be GEODISTANCE CALCULATOR' but only shows 'GEODISTANCE CA'. What causes this incompatibility and how can I

How to fix buttons not showing properly using Python, PyQt5, and Pyinstaller

∥☆過路亽.° 提交于 2021-02-05 11:10:29
问题 I created an interface using Qt Designer and integrated it into my python code using PyQt5. I then created an exe file using Pyinstaller and the interface shows up fine on my laptop using Windows 10 Home. However testing on a different windows machine using Windows 10 Pro shows the buttons and labels all cut out , with wrong font and all as shown below. For example, the top title should be GEODISTANCE CALCULATOR' but only shows 'GEODISTANCE CA'. What causes this incompatibility and how can I

How to properly initialize a QWizard page?

落花浮王杯 提交于 2021-02-05 10:49:49
问题 I am having problems with sending data from one QWizard page to the next. I'm using a variable my_name of QWizard object as a container. My approach is: whenever I change text of QLineEdit on Page1 , the variable my_name of my QWizard object changes. And whenever I click Next button on Page1 , Page2 is initialized using the method QWizard.initializePage(2) . But the QLabel object on Page2 is not update based on the my_name variable of QWizard object. Even though I have initialized the Page2

Why the symbol  does not translate to ✰ inside the paintEvent?

℡╲_俬逩灬. 提交于 2021-02-05 09:39:20
问题 I have this code import sys import os from PyQt5.QtWidgets import * from PyQt5.QtGui import * DIR_PATH = os.path.dirname(os.path.realpath(__file__)) class ThinLabel(QLabel): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def paintEvent(self, event): qp = QPainter(self) qp.setRenderHint(QPainter.Antialiasing) path = QPainterPath() path.addText(event.rect().bottomLeft(), self.font(), self.text()) qp.setPen(QPen(self.palette().color(QPalette.Window), 2)) qp.setBrush(self

I want to put the text in pyqt QCalendarWidget

谁说胖子不能爱 提交于 2021-02-05 08:31:15
问题 I would like to put the text of p.drawText (r.x () + 10, r.y () + 33, '{} / {}'. Format ('tset1', 'test2') condition on the selected QCalendarWidget date. But it is not good. import sys from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * class main_window(QWidget): def __init__(self): super(main_window, self).__init__() self.resize(1280, 900) self.Calendar() def Calendar(self): self.cal = QCalendarWidget(self) self.cal.resize(500, 500) self.cal.clicked.connect

I want to put the text in pyqt QCalendarWidget

最后都变了- 提交于 2021-02-05 08:31:01
问题 I would like to put the text of p.drawText (r.x () + 10, r.y () + 33, '{} / {}'. Format ('tset1', 'test2') condition on the selected QCalendarWidget date. But it is not good. import sys from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * class main_window(QWidget): def __init__(self): super(main_window, self).__init__() self.resize(1280, 900) self.Calendar() def Calendar(self): self.cal = QCalendarWidget(self) self.cal.resize(500, 500) self.cal.clicked.connect

I want to put the text in pyqt QCalendarWidget

佐手、 提交于 2021-02-05 08:30:07
问题 I would like to put the text of p.drawText (r.x () + 10, r.y () + 33, '{} / {}'. Format ('tset1', 'test2') condition on the selected QCalendarWidget date. But it is not good. import sys from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * class main_window(QWidget): def __init__(self): super(main_window, self).__init__() self.resize(1280, 900) self.Calendar() def Calendar(self): self.cal = QCalendarWidget(self) self.cal.resize(500, 500) self.cal.clicked.connect

Plotting with pyqtgraph without displaying

。_饼干妹妹 提交于 2021-02-05 08:09:10
问题 I am trying to move from matplotlib to plotting with pyqtgraph because of its touted capabilities to render and save images faster. In my attempts to do this on a cluster with multiprocessors, I run into the following trouble: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user' qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display. How do I obviate displaying a plot, and save it directly to file? Here's my attempt at the code: