pyqt4

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()

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

Rotating a pixmap in pyqt4 gives undesired translation

…衆ロ難τιáo~ 提交于 2021-02-10 05:17:14
问题 I'm trying to write a simple application that rotates a png image when a button is pressed. I have it all working fine except that as the image rotates it deviates from it's centre in a south-east direction. I would have thought it wasn't rotating around its centre, but it returns to the origin every 45 degrees of rotation, which is strange. On a key event I'm simply calling: pixmap = pixmap.transformed(QtGui.QTransform().rotate(-self.rot), QtCore.Qt.SmoothTransformation) Is there a way to

can't seem to fix PyCharm warnings in a simple PyQt program

六月ゝ 毕业季﹏ 提交于 2021-02-08 15:06:39
问题 The following program (an extract of my real code) from PyQt4 import QtGui import sys from PyQt4.QtGui import QMessageBox def main(): app = QtGui.QApplication([]) w = QtGui.QPushButton("Test") def on_pressed(): print("Pressed") QMessageBox.warning(w, 'Info', 'Button Pressed') w.pressed.connect(on_pressed) w.show() sys.exit(app.exec_()) if __name__ == '__main__': main() triggers the following three warnings in PyCharm (eg when running Code/Inspect Code... ) related to the QMessageBox.warning

How do i catch system Logoff/ShutDown/Lock events in Python or PyQt4

随声附和 提交于 2021-02-08 08:20:28
问题 I have an application in .NET now i am recoding it using Python and PyQt. In my application i need to know system events (Lock,Logoff,Restart and Shutdown). I could able to manage it from .NET Frame work 3.5 using below snippit AddHandler SystemEvents.SessionEnding, AddressOf ClosingApplication AddHandler SystemEvents.SessionSwitch, AddressOf SessionSwitchEvent Depending on the system i need to do some stuff to update my Database. Can any one help me plz... 回答1: You are going to need to use

PyQt4 - how to add scrollbar into tabbed windows of fixed size?

旧巷老猫 提交于 2021-02-08 06:34:51
问题 Simplest case: How do you add a scrollbar to a tabbed GUI window of fixed size? Full case: I'm working with a GUI with non-scaleable objects (scenes) in each tabbed frame, and would like the user to still be able to drag-scale the window down on itself (whereby the objects in the scene don't scale, but just get hidden as the window-drag moves over them) and a scroll bar appears. This is the minimal, working code that I've written to help exemplify: import sys from pyface.qt import QtGui,

PyQt: Multiple QProcess and output

时光总嘲笑我的痴心妄想 提交于 2021-02-08 03:38:55
问题 I have a PyQt window that calls multiple executables as QProcess. How can I list the outputs of each process after the last one has finished? (something like process_result = ["result1", "result2",..]) Let us say it looks like this: for i in list_of_processes: process = QtCore.QProcess() process.start(i) I can read with process.readyReadStandardOutput() somehow but it is quite chaotic because processes run parallel. process.waitForFinished() does not work because the GUI will freeze. Also, I

How do i add or import pyqt and sip to Python

十年热恋 提交于 2021-02-07 20:29:47
问题 im having trouble importing this. i am a newbie so please use layman words i can follow:p. riverbank said i need sip. but there is a sip folder in the pyqt download i installed, so do i have it already? there are some related questions on this site, which lead me to try these method:.. my pyqt folder is PyQt-win-gpl-4.9.4. so i typed: sys.path.append('C:\Program Files\PyQt-win-gpl-4.9.4\sip') this adds it fine, inside the 'sip' folder, it has a bunch of folders like QtCore etc.. and ive tried

Mouse coordinates of pytqt graph line

时光怂恿深爱的人放手 提交于 2021-02-07 20:28:38
问题 I am trying to get the (x,y) values of my random function plot whenever I move the moused on top of the graph. I am using pyqtgraph.SignalProxy and connect it to a callback mousedMoved. I am getting this as error: NameError: global name 'mouseMoved' is not defined Here is the code: import sys from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg import time import random class TestClass(QtGui.QMainWindow): ##################################################### def _

How do i add or import pyqt and sip to Python

人走茶凉 提交于 2021-02-07 20:28:18
问题 im having trouble importing this. i am a newbie so please use layman words i can follow:p. riverbank said i need sip. but there is a sip folder in the pyqt download i installed, so do i have it already? there are some related questions on this site, which lead me to try these method:.. my pyqt folder is PyQt-win-gpl-4.9.4. so i typed: sys.path.append('C:\Program Files\PyQt-win-gpl-4.9.4\sip') this adds it fine, inside the 'sip' folder, it has a bunch of folders like QtCore etc.. and ive tried