pyqt

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

Printing QProcess Stdout only if it contains a Substring

夙愿已清 提交于 2021-02-10 16:01:36
问题 A PyQt4 app runs ping in a QProcess . A QTextEdit named self.output will output everything from ping . A second QTextEdit named self.summary will only output the line if it contains the string TTL . Problem: I have managed to get self.output working but not self.summary as I am not sure how to write its code in the dataReady function. Any ideas? import sys from PyQt4 import QtGui, QtCore class MainWindow(QtGui.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.initUI()

Printing QProcess Stdout only if it contains a Substring

我只是一个虾纸丫 提交于 2021-02-10 16:00:40
问题 A PyQt4 app runs ping in a QProcess . A QTextEdit named self.output will output everything from ping . A second QTextEdit named self.summary will only output the line if it contains the string TTL . Problem: I have managed to get self.output working but not self.summary as I am not sure how to write its code in the dataReady function. Any ideas? import sys from PyQt4 import QtGui, QtCore class MainWindow(QtGui.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.initUI()

Printing QProcess Stdout only if it contains a Substring

梦想的初衷 提交于 2021-02-10 16:00:27
问题 A PyQt4 app runs ping in a QProcess . A QTextEdit named self.output will output everything from ping . A second QTextEdit named self.summary will only output the line if it contains the string TTL . Problem: I have managed to get self.output working but not self.summary as I am not sure how to write its code in the dataReady function. Any ideas? import sys from PyQt4 import QtGui, QtCore class MainWindow(QtGui.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.initUI()

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

Copy/paste text from QClipboard freezes program

喜欢而已 提交于 2021-02-10 14:14:55
问题 I have a QTableWidget that when a row is clicked, it selects all cells in that row. I am trying to add a "copy" functionality so that I can ^ctrl-c when row(s) are selected and paste into a text editor. However, with my current code, once i ^ctrl-c a row, the line that I copied keeps getting copied. I have implemented a print statement in my method "read_clipboard" to see whether or not the line copied was read, and this is how I found out that the line keeps getting copied as if in an

How can I set a QFileSystemModel with information from another PC?

孤街醉人 提交于 2021-02-10 13:38:11
问题 I'm doing a college project where we need to set up a dropbox-like service in a local network. I can do it easily in a terminal, but for some extra points I'm trying to set up an QtPy ui for it. One of my widgets it's a QTreeView with a QFileSystemModel where I'd like to visualize the files and folders the user has saved on his "dropbox". The thing is, that the information and the folder itself are in another computer. I've tried sending the widget from one pc to another but you can't pickle