pyqt5

Drag items between QTreeWidget and QListWidget in PyQt5?

拈花ヽ惹草 提交于 2021-02-10 07:09:20
问题 I have a QListWidget and a QTreeWidget and I want to be able to drag one or multiple list items around within each one as well as between them. I have the internal drag and drop working, but I'm not sure how to drag between them. When I print event.mimeData().formats() in my code below it says ['application/x-qabstractitemmodeldatalist'] . I am stuck on how to extract the text and index of that item (it should be a QListWidgetItem or QTreeWidgetItem, right?) so I can delete the original from

How to correctly lock Qthreads in pyqt5 using Python3

…衆ロ難τιáo~ 提交于 2021-02-10 06:29:09
问题 I am relatively new to python, but was able to get a reasonably useful program to run to crunch a lot of data. I am able to run it over multiple sets of data sequentially using another python script to call the program serially, but I wanted to create a GUI and use multithreading to allow others to use it without knowing all the ins and outs of programming. I created the GUI successfully, and can feed data bidirectionally using signals and slots. What I am having trouble with is creating

Mouse movements too fast for `mouseMoveEvent()`

♀尐吖头ヾ 提交于 2021-02-10 05:21:25
问题 The following Python 3 resp. UI XML code shows 4 QProgessBar for each mouse direction (labeled X+, X-, Y+, Y-). Fast mouse movements (in circles) will make the 4 QProgessBar move up to 99% and then some of the QProgessBar take a break until the mouse movements are slowed down to finally reach 100%. What's the reason for this behavior ? How can the code be fixed so that no QProgessBar takes a break at 99% ? main.py import sys from PyQt5.QtCore import Qt from PyQt5.QtGui import QCursor from

How to Add Dynamic Data to a QML Table

三世轮回 提交于 2021-02-09 11:46:22
问题 I'm trying to add rows to a table from Python. I'm using a TableView described with QML. I can't figure out how to add a model to the table, unless the model is also in QML. But I can't figure out how to add values to the model. import sys from PyQt5.QtCore import QAbstractTableModel, QObject, QUrl from PyQt5.QtQml import QQmlApplicationEngine from PyQt5.QtQuick import QQuickView from PyQt5.QtWidgets import QApplication myApp = QApplication(sys.argv) engine = QQmlApplicationEngine() context =

PyQt5 QTabBar paintEvent with tabs that can move

吃可爱长大的小学妹 提交于 2021-02-08 12:12:37
问题 I would like to have a QTabBar with customised painting in the paintEvent(self,event) method, whilst maintaining the moving tabs animations / mechanics. I posted a question the other day about something similar, but it wasn't worded too well so I have heavily simplified the question with the following code: from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtTest import QTest import sys class MainWindow(QMainWindow): def __init__(self,parent=None,

PyQt5 QTabBar paintEvent with tabs that can move

蹲街弑〆低调 提交于 2021-02-08 12:10:33
问题 I would like to have a QTabBar with customised painting in the paintEvent(self,event) method, whilst maintaining the moving tabs animations / mechanics. I posted a question the other day about something similar, but it wasn't worded too well so I have heavily simplified the question with the following code: from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtTest import QTest import sys class MainWindow(QMainWindow): def __init__(self,parent=None,

How to append serial data on textbrowser pyqt5 receiving from serial port python pyqt [duplicate]

送分小仙女□ 提交于 2021-02-08 11:35:07
问题 This question already has answers here : Connect to serial from a PyQt GUI (2 answers) Closed 18 days ago . My goal is to create a GUI using PyQt5 with functionality to receive data from serial port. This data should be printed into text browser inside the GUI. Data should be printed there continuously. Reading should be toggled by pushing button. This is the GUI part of the code: class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow

How to append serial data on textbrowser pyqt5 receiving from serial port python pyqt [duplicate]

爱⌒轻易说出口 提交于 2021-02-08 11:34:40
问题 This question already has answers here : Connect to serial from a PyQt GUI (2 answers) Closed 18 days ago . My goal is to create a GUI using PyQt5 with functionality to receive data from serial port. This data should be printed into text browser inside the GUI. Data should be printed there continuously. Reading should be toggled by pushing button. This is the GUI part of the code: class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow

PyQt5 from QLineEdit to variable [duplicate]

笑着哭i 提交于 2021-02-08 10:24:30
问题 This question already has answers here : How to get text in QlineEdit when QpushButton is pressed in a string? (3 answers) Closed 2 years ago . I have created a simple PyQt5 User Interface that looks like this: import sys from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QLineEdit class App(QWidget): def __init__(self): super().__init__() self.title = 'Test' self.left = 10 self.top = 10 self.width = 400 self.height = 500 self.initUI() def initUI(self): self.setWindowTitle(self

PyQt5 from QLineEdit to variable [duplicate]

泄露秘密 提交于 2021-02-08 10:23:18
问题 This question already has answers here : How to get text in QlineEdit when QpushButton is pressed in a string? (3 answers) Closed 2 years ago . I have created a simple PyQt5 User Interface that looks like this: import sys from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QLineEdit class App(QWidget): def __init__(self): super().__init__() self.title = 'Test' self.left = 10 self.top = 10 self.width = 400 self.height = 500 self.initUI() def initUI(self): self.setWindowTitle(self