pyqt5

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

PyQt5 designer gui and iterate/loop over QPushButton [duplicate]

試著忘記壹切 提交于 2021-01-29 14:44:26
问题 This question already has answers here : Python 'called with the wrong argument type' error (1 answer) Set properties of multiple QLineEdit using a loop (3 answers) Closed 9 months ago . Hi I have a GUI with 26 QPushButtons named A to Z, using uicload I load into my Main class is there any way to loop over them to end up with something self.A.clicked.connect(self.foo(A)) # .. self.Z.clicked.connect(self.foo(Z)) tried different ways but I end up always with either a syntax error or a

Register Account(window) Rejection when value is on database (MySQL)

你。 提交于 2021-01-29 14:23:44
问题 def Register(self): QMessageBox.about(self,"Successfully Saved Data",'saved') username = self.lineEdit.text() pwd = self.lineEdit_2.text() cursor = self.connek.cursor() into_data = 'insert into login(username,passwrd) values(%s,%s);' db_column = (username , pwd) cursor.execute(into_data, db_column) self.connek.commit() cursor1 = self.connek.cursor() cursor1.execute('select username, passwrd from login;') x = cursor1.fetchall() print(x) login.show() reg.hide() cursor.close() Hi guys I'm new to

ValueError: could not convert string to float: when using matplotlib, arduino and pyqt5

筅森魡賤 提交于 2021-01-29 14:02:21
问题 While using an arduino code (also connecting pin 13 to A0 in an arduino uno) to have changing values int PinOutput = 13; int PinInput = A0; int inph; int inpl; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(PinInput, INPUT); pinMode(PinOutput, OUTPUT); } void loop() { // put your main code here, to run repeatedly: inpl = analogRead(PinInput)/4; Serial.println(inpl); analogWrite(PinOutput,255); delay(1000); inph = analogRead(PinInput)/4; Serial.println

Python3: ImportError: /lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found

这一生的挚爱 提交于 2021-01-29 13:48:22
问题 I created a Window on Qt with Qt Designer and when I launch that app - I get ImportError. It feels like that library doesn't installed in my system. But the preview works in Qt Designer. Full code of design file: # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'map.ui' # # Created by: PyQt5 UI code generator 5.15.0 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing.

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

Realtime visualisation bottleneck with pyqtgraph / PlotCurveItem

我与影子孤独终老i 提交于 2021-01-29 12:32:03
问题 I am currently using pyqtgraph to visualize realtime data for 64 independent data traces/plots. While the speed is realtively good, I noticed a serious slow down if the sample buffer length reaches beyond 2000 points. Profiling the following code yields that functions.py:1440(arrayToQPath) seems to have a major impact: import numpy import cProfile import logging import pyqtgraph as pg from PyQt5 import QtCore,uic from PyQt5.QtGui import * from PyQt5.QtCore import QRect, QTimer def program

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 =

How do I open (and close) a PyQt5 application inside a loop, and get that loop running multiple times

二次信任 提交于 2021-01-29 11:21:05
问题 The following is a loop that I created: import mainui import loginui from PyQt5 import QtWidgets import sys while True: print('test') app = QtWidgets.QApplication(sys.argv) ui = loginui.Ui_MainWindow() ui.setupUi() ui.MainWindow.show() app.exec_() username=ui.username app2 = QtWidgets.QApplication(sys.argv) ui2 = mainui.Ui_MainWindow(username) ui2.setupUi() ui2.MainWindow.show() app2.exec_() if ui2.exitFlag=='repeat':#Repeat Condition continue else: #Exit Condition sys.exit() This is a loop

PyQT5: How to interactively paint on image within QLabel Widget? [duplicate]

◇◆丶佛笑我妖孽 提交于 2021-01-29 11:13:17
问题 This question already has an answer here : Drawing with a brush (1 answer) Closed 2 years ago . Python 3, latest version of PyQt5 on Mac OS Mojave I want a PyQt5 program in which the user could paint connected dots on an image (click distinctively and the points are automatically connected). It is important that I can only draw on the image in the QLabel widget (or an alternative widget) and not over the entire main window. I can plot the image and get the the coordinates of the previous two