this my code: import socket, sys, time, res from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5 import uic SERVER = socket.gethostbyname(socket.gethostname()) class AThread(QThread): sign = pyqtSignal(str) def __init__(self): super().__init__() def run(self): self.aa = True while self.aa: a = "Hello World!!" self.sign.emit(a) time.sleep(0.5) def stop(self): self.aa = False class MainWindow(QWidget): ..
I tried to signal Qlabel so that I could draw quickly using multithreading. My ultimate goal is to replace Qlabel with an image drawn by Matplotlib.I’m sure the signal does pass, but it’s not added to the UI. class Work(QObject): count_signal = pyqtSignal(QtWidgets.QLabel) def __init__(self, parent=None): super(Work, self).__init__(parent) self.run = True def start(self): print(‘current id’, ..
I want to make the label item of a plot clickable, that is, I can click the bottom or left label of a plot to call a menu. My attempt: The most obvious way is to rewrite the LabelItem class and overwrite the mousePressEvent() function, however, I did not see any methods in docs to ..
There should be radiobuttons created for each row/column, and each radiobutton should give the label# and stg#. My example halfway works but currently its printing multiple print lines for each radiobutton clicked. Is there a better way to do this? from PyQt5 import QtCore, QtGui, QtWidgets import sys class Assign(QtWidgets.QMainWindow): def __init__(self, parent=None): super().__init__() self.parent ..
I have a table that’s being populated from a database. you can edit the table then update the database with the new data. I have this: def populate(self): tablerow = 0 rowcount = 0 self.ui.widget_unass_fights.clearContents() self.ui.widget_unass_fights.setRowCount(0) for row in x: rowcount += 1 self.ui.widget_unass_fights.setRowCount(rowcount) self.ui.widget_unass_fights.setItem(tablerow, 0, QtWidgets.QTableWidgetItem(str(row))) self.ui.widget_unass_fights.setItem(tablerow, 2, QtWidgets.QTableWidgetItem(str(row))) self.ui.widget_unass_fights.setItem(tablerow, 3, QtWidgets.QTableWidgetItem(str(row))) self.ui.widget_unass_fights.setItem(tablerow, 4, ..
I would like to program a hangman game in pyqt5. Now i have a problem, i have no plan of how to draw a half circle in pyqt5. I would be happy if someone shows me a code example that I can use that. Thanks in advance Source: Python-3x..
I’m new to Python and PyQt5 and I’ve been working on creating a simple door lock application using PyQt5. My aim is to display buttons and camera streaming on the same window but it’s separated. I’ve looked up but I couldn’t find much information about this issue. I’m sorry in advance if it’s duplicated. class ..
I am not Python programmer but I’m studying a web browser. I need to check or validate url from QLineEdit if is not valid url will search the text on google for example or another search engine … self.searchbar = QLineEdit() self.searchbar.returnPressed.connect(self.goToSearch) self.navigationbar.addWidget(self.searchbar) … def goToSearch(self): #text = QUrl.fromUserInput(self.searchbar.text()) text = QUrl(self.searchbar.text()) if not text.isValid(): ..
I’m having trouble trying to undersand how the window objects work. I have a real time plot on a secundary window via matplotlib. This plot updates every second with the new calculated values. What I expect is the method to stop running whenever I close this 2nd window and restarts when I reopen it. I’m ..
In PyQt, I have a really particular issue where I run a function on a secondary thread that creates QWidgets to be displayed in the GUI If I do this and create these QWidgets on the separate thread, trying to add them to the GUI (using something like addWidget()), causes an error: Ex) # tl ..