pyqt5

access element from .ui

扶醉桌前 提交于 2021-02-10 20:25:52
问题 I have problem to access my button and label from my dialog.ui. I am using Python 3.x and QT Designer 5.x. from PyQt5 import uic, QtWidgets from PyQt5.QtWidgets import QApplication Form, Window = uic.loadUiType("dialog.ui") #load ui (GUI) file app = QApplication([]) #create a QApplication window = Window() form = Form() form.setupUi(window) def on_click(): # self.qlFreeText.text("hello") alert = QMessageBox() alert.setText("You clicked the button!") alert.exec_() class Ui(QtWidgets

PyQt5 - how to bring the Qfiledialog to the front?

余生长醉 提交于 2021-02-10 20:15:57
问题 My code uses PyQt to open up a folder select dialog. Once a folder is selected it is minimized. I'd like for the dialog to pop up in front of any other windows. I haven't been able to find a solution yet. Any suggestions? from sys import executable, argv from subprocess import check_output from PyQt5.QtWidgets import QFileDialog, QApplication def gui_fname(directory=''): file = check_output([executable, __file__, directory]) return file.strip() if __name__ == "__main__": directory = argv[1]

How to reference resource file in PyQt stylesheet using fbs

荒凉一梦 提交于 2021-02-10 19:34:48
问题 I am building a PyQt5 application using fbs and (following this tutorial) have placed the image files in the directory /src/main/resources/base/images . This way the image resources are available to the Python code using ApplicationContext.get_resource("images/xxxx.png") . The build system manages the correct file path depending on whether we are running from source or the compiled version of the app. I would like to access these images in my PyQt stylesheets, along the lines of QTreeView:

How to reference resource file in PyQt stylesheet using fbs

爷,独闯天下 提交于 2021-02-10 19:34:13
问题 I am building a PyQt5 application using fbs and (following this tutorial) have placed the image files in the directory /src/main/resources/base/images . This way the image resources are available to the Python code using ApplicationContext.get_resource("images/xxxx.png") . The build system manages the correct file path depending on whether we are running from source or the compiled version of the app. I would like to access these images in my PyQt stylesheets, along the lines of QTreeView:

How to reference resource file in PyQt stylesheet using fbs

不问归期 提交于 2021-02-10 19:33:17
问题 I am building a PyQt5 application using fbs and (following this tutorial) have placed the image files in the directory /src/main/resources/base/images . This way the image resources are available to the Python code using ApplicationContext.get_resource("images/xxxx.png") . The build system manages the correct file path depending on whether we are running from source or the compiled version of the app. I would like to access these images in my PyQt stylesheets, along the lines of QTreeView:

PyQt: How to run GUI on Raspberry Pi desktop startup?

北城以北 提交于 2021-02-10 15:09:31
问题 Dear Stackoverflow community, I am struggling with running a python script that executes a PyQt5 GUI on desktop startup of Raspberry Pi 3B with Raspbian Jessie. What do I have so far? Python script with shebang #!/usr/bin/env python3 in first line ( python3 --version is 3.4.2) running the GUI without any problems Shell script (.sh) that is able to execute the GUI with the following lines: #!/bin/bash python3 GUI.py Information that may help: If I place both files in the same directory

PyQt: How to run GUI on Raspberry Pi desktop startup?

寵の児 提交于 2021-02-10 15:02:28
问题 Dear Stackoverflow community, I am struggling with running a python script that executes a PyQt5 GUI on desktop startup of Raspberry Pi 3B with Raspbian Jessie. What do I have so far? Python script with shebang #!/usr/bin/env python3 in first line ( python3 --version is 3.4.2) running the GUI without any problems Shell script (.sh) that is able to execute the GUI with the following lines: #!/bin/bash python3 GUI.py Information that may help: If I place both files in the same directory

PyQt video frame update signal (Trigger function after each video frame)

五迷三道 提交于 2021-02-10 14:44:33
问题 I am creating a video player and I need to draw some polygons on top of it. I am using a QGraphicsScene to create this and I need to update the polygons on screen after each frame. I am currently using the QMediaPlayer paired up with a QGraphicsVideoItem to create this. The problem I am having is that the QMediaPlayer doesn't have a signal that activates on each frame. It has positionChanged(), but this only seems to trigger once every second. I tried using QMovie since it does send updates

How to set PyQt5 Qtimer to update in specified interval?

a 夏天 提交于 2021-02-10 14:18:19
问题 I would like to update the Qtimer according to a framerate of 15 FPS - so my def update(): recieves a signal every 0,06 s. Can you help me? I have attached a code example below where my setInterval input is 1/15, but I dont know if that is the way to go. Thanks. from PyQt5 import QtCore def update(): print('hey') fps = 15 timer = QtCore.QTimer() timer.timeout.connect(update) timer.setInterval(1/fps) timer.start() 回答1: You have the following errors: setInterval() receives the time in

Drag items between QTreeWidget and QListWidget in PyQt5?

大憨熊 提交于 2021-02-10 07:13:23
问题 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