pyqt

Run command with PyQt5 and getting the stdout and stderr

无人久伴 提交于 2021-01-30 09:05:03
问题 I want to run command with PyQt5. And I want to get the stdout and stderr in time order and in real-time. I separated into UI class and Worker class. There are several UI classes, but for simplicity, I've specified just one. I've tried to solve this problem, but I can't. I can't connect between the Worker thread and logger function. test_ui.py import sys import subprocess from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout from PyQt5.QtWidgets import QPushButton,

QLabel is not updated unless the mainWindow is unfocused

依然范特西╮ 提交于 2021-01-29 22:34:12
问题 I am trying "Hello World" using PyQt5 with Python 3.7.3 and macOS 10.14.6. Executing pyqt_helloworld.py below and clicking the button will update the label to "Hello World". However, when the button is clicked, the text is not changed, and it is not until I focus on the window of other application manually that the label is updated. How can I update QLabel without unfocusing the PyQt application? Thanks in advance! pyqt_helloworld_ui.py from PyQt5 import QtCore, QtGui, QtWidgets class Ui

QLabel is not updated unless the mainWindow is unfocused

我与影子孤独终老i 提交于 2021-01-29 22:13:30
问题 I am trying "Hello World" using PyQt5 with Python 3.7.3 and macOS 10.14.6. Executing pyqt_helloworld.py below and clicking the button will update the label to "Hello World". However, when the button is clicked, the text is not changed, and it is not until I focus on the window of other application manually that the label is updated. How can I update QLabel without unfocusing the PyQt application? Thanks in advance! pyqt_helloworld_ui.py from PyQt5 import QtCore, QtGui, QtWidgets class Ui

QLabel is not updated unless the mainWindow is unfocused

て烟熏妆下的殇ゞ 提交于 2021-01-29 21:51:22
问题 I am trying "Hello World" using PyQt5 with Python 3.7.3 and macOS 10.14.6. Executing pyqt_helloworld.py below and clicking the button will update the label to "Hello World". However, when the button is clicked, the text is not changed, and it is not until I focus on the window of other application manually that the label is updated. How can I update QLabel without unfocusing the PyQt application? Thanks in advance! pyqt_helloworld_ui.py from PyQt5 import QtCore, QtGui, QtWidgets class Ui

matplotlib in second window pyqt5

心已入冬 提交于 2021-01-29 20:12:38
问题 I wish to plot a matplotlib graph in a second window when a button is clicked in the main window. Using https://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html , which plots a graph in the main window, I wrote the code below. The matplotlib graph is indeed plotted in a second window, but it has a very small size and I don't understand how to adjust the size of the graph to the window. May I have some help? from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication,

How to connect two QGraphicsItem by drawing line between them (using mouse)

风格不统一 提交于 2021-01-29 15:40:27
问题 I have some custom items in the scene. I would like to allow the user to connect the two items using the mouse. I checked an answer in this question but there wasn't a provision to let users connect the two points. (Also, note that item must be movable) Here is a demonstration of how I want it to be: I want the connection between the two ellipses as shown above Can I know how this can be done? 回答1: While the solution proposed by JacksonPro is fine, I'd like to provide a slightly different

Python Qt - How to insert items in Table widget from another Thread?

喜欢而已 提交于 2021-01-29 14:30:46
问题 I want to insert text items from a Worker Qthread to a QTableWidget UI in Main thread ?. I want to know the Syntax to create the signal in Main thread , so I can insert the text as well as the row and column from Worker thread by sending via signal class Example(QWidget): def __init__(self): super().__init__() self.myclass2 = myclass2() self.myclass2.start() self.initUI() def initUI(self): self.setGeometry(300, 300, 300, 220) self.setWindowTitle('Icon') self.setWindowIcon(QIcon('web.png'))

Accurate timer with PyQt

六眼飞鱼酱① 提交于 2021-01-29 13:32:10
问题 I'm using pyqtgraph to plot a huge number of data that I receive from sensors. To do so, I made one thread that acquire the data and put in a queue. To plot the data, I check periodically with a timer if the queue is not empty. The problem is that the accuracy of the timer (QTimer) seems to be really bad. I mean when the load is low (sleep for 1000/100 ms) in the measuring thread, the accuracy is pretty good but when the load increase (sleep for 10ms), my update function used to plot data is

Need advice to keep GUI responsive

我只是一个虾纸丫 提交于 2021-01-29 13:31:13
问题 Basically, what I have is a GUI with some QLineEdits, a "search button" and a table. You hit the button and a class called DataGrabber searches a database for data, processes them, returns a list with dictionaries with which the table is filled, accordingly. These searches can take a while and I need to keep my GUI responsive. Also, I want the statusbar message to change as long as the search is going on (something like "Searching." -> "Searching.." -> "Searching...", the functionality is not

PyQt widget border color transparent - but button inside normal border

旧时模样 提交于 2021-01-29 12:29:15
问题 I want the border of my QTWidgets.QWidget to be transparent or disabled (borderwidth=0), but when I set it via the stylesheet to "border:0", also all the push buttons inside the widget dont have a border - any idea how to keep the style of the pushbuttons and only change the widget border ? class lamp_frame(object): def setupUi(self, window): window.setObjectName("Yeelight Controlle") window.resize(460, 140+self.window_hight) window.setFixedSize(460, 140+self.window_hight) self.frame_0 =