pyqt5

How to get cursor click position in QGraphicsItem coordinate system?

99封情书 提交于 2021-02-07 20:55:29
问题 I have a QGraphicsScene with QGraphicsItem added to it. Suppose I clicked on a map image ( QGraphicsItem ) where green circle is drawn. How to get click position in terms of this QGraphicsItem and not QGraphicsScene coordinate system. P.S. Please, don't write code with mouse event handling. Just how to map click position correctly. Thanks in advance. 回答1: The idea is to convert the coordinate with respect to the scene to a coordinate with respect to the item. - Override mousePressEvent in

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

时光总嘲笑我的痴心妄想 提交于 2021-02-07 17:29:22
问题 I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import * import os, time, sys def btn_pressed(): global r return lambda: r.setProperty("source", "/home/pi/Desktop/example/sample/img/img1.jpg") button1 = Button(20) myApp = QGuiApplication([]) myEngine = QQmlApplicationEngine() directory = os.path.dirname(os

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

▼魔方 西西 提交于 2021-02-07 17:28:38
问题 I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import * import os, time, sys def btn_pressed(): global r return lambda: r.setProperty("source", "/home/pi/Desktop/example/sample/img/img1.jpg") button1 = Button(20) myApp = QGuiApplication([]) myEngine = QQmlApplicationEngine() directory = os.path.dirname(os

How to play multiple clips of a video one after another

ぐ巨炮叔叔 提交于 2021-02-07 16:47:25
问题 I have a video, from which I am getting some clips by time interval, and I want to do the following: Make the clips play one after another - so first clip plays, then after it is done, then second plays, and so on... But currently, it's good, but it just plays the part in between the time intervals of the two clips, which I don't want it to do. How would I go about doing that? I tried using e.g. pause , stop , etc... simply everything, but none of them worked. My version of python: 3.6.0 And

How to play multiple clips of a video one after another

末鹿安然 提交于 2021-02-07 16:45:46
问题 I have a video, from which I am getting some clips by time interval, and I want to do the following: Make the clips play one after another - so first clip plays, then after it is done, then second plays, and so on... But currently, it's good, but it just plays the part in between the time intervals of the two clips, which I don't want it to do. How would I go about doing that? I tried using e.g. pause , stop , etc... simply everything, but none of them worked. My version of python: 3.6.0 And

How to play multiple clips of a video one after another

雨燕双飞 提交于 2021-02-07 16:42:15
问题 I have a video, from which I am getting some clips by time interval, and I want to do the following: Make the clips play one after another - so first clip plays, then after it is done, then second plays, and so on... But currently, it's good, but it just plays the part in between the time intervals of the two clips, which I don't want it to do. How would I go about doing that? I tried using e.g. pause , stop , etc... simply everything, but none of them worked. My version of python: 3.6.0 And

How to play multiple clips of a video one after another

吃可爱长大的小学妹 提交于 2021-02-07 16:41:56
问题 I have a video, from which I am getting some clips by time interval, and I want to do the following: Make the clips play one after another - so first clip plays, then after it is done, then second plays, and so on... But currently, it's good, but it just plays the part in between the time intervals of the two clips, which I don't want it to do. How would I go about doing that? I tried using e.g. pause , stop , etc... simply everything, but none of them worked. My version of python: 3.6.0 And

sphinx-apidoc picks up submodules, but autodoc doesn't document them

懵懂的女人 提交于 2021-02-07 14:19:27
问题 I've been working on a project for PyQt5 ( found here: https://github.com/MaVCArt/StyledPyQt5 ) which uses a package structure to make imports a bit more logical. I've been relatively successful in documenting the code so far with Sphinx, at least up until I introduced the package structure. ( before, everything was in one folder ) The following is the problem: when I run sphinx-apidoc, everything runs fine, no errors. What's more, autodoc picks up all my submodules just fine. This is the

PyQT User Editable Polygons

不想你离开。 提交于 2021-02-07 10:19:54
问题 I am using QPainter and QPolygon classes to paint polygons over an image. I need the user to be able to edit this polygons by dragging the points in them. The QPolygon and QPainter classes don't have any signals, so I can't trigger the event through them. I have realized that if I keep on using this approach, then the image would have to be rendered each time a point is moved would probably look really bad and not smooth at all. Anybody know how I could put these points on top of the image

PyQT User Editable Polygons

妖精的绣舞 提交于 2021-02-07 10:18:07
问题 I am using QPainter and QPolygon classes to paint polygons over an image. I need the user to be able to edit this polygons by dragging the points in them. The QPolygon and QPainter classes don't have any signals, so I can't trigger the event through them. I have realized that if I keep on using this approach, then the image would have to be rendered each time a point is moved would probably look really bad and not smooth at all. Anybody know how I could put these points on top of the image