Is there a way to take screenshot of a window in pyqt5 or qt5?

Ref: http://doc.qt.io/qt-5/qscreen.html#grabWindow You say you require a screenshot of a window, therefore screenshot = screen.grabWindow(0, 0, 0, 100, 100) is not the appropriate call here, since it captures the entire screen, cropped according to the final 4 parameters. (the 100 parameters are width and height). screenshot = screen.grabWindow( widget.winId() ) captures the widget window. However, … Read more

Scraping Javascript driven web pages with PyQt4 – how to access pages that need authentication?

I figured it out. Here’s what I ended up with in case it can help someone else. #!/usr/bin/python # -*- coding: latin-1 -*- import sys import base64 from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.QtWebKit import * from PyQt4 import QtNetwork class Render(QWebPage): def __init__(self, url): self.app = QApplication(sys.argv) username=”username” password = ‘password’ … Read more

PyQt5 and QtGui module not found

When first trying pyqt4 and pyqt5 and the pycharm IDE I had many problems with imports. (although the imports had no prob running from IDLE) Eventually after much stuffing around, uninstalling and reinstalling, (including dependencies) the imports sorted themselves out. Did you install pyqt5 using an installer from the pyqt website? You must. Qt designer … Read more

PyQt4 center window on active screen

Modify your center method to be as follows: def center(self): frameGm = self.frameGeometry() screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center() frameGm.moveCenter(centerPoint) self.move(frameGm.topLeft()) This function is based on where the mouse point is located. It uses the screenNumber function to determine which screen the mouse is current active on. It then finds the screenGeometry of that monitor … Read more

What is the easiest way to achieve realtime plotting in pyqtgraph

Pyqtgraph only enables realtime plotting by being quick to draw new plot data. How to achieve realtime plotting is highly dependent on the details and control flow in your application. The most common ways are: Plot data within a loop that makes calls to QApplication.processEvents(). pw = pg.plot() while True: … pw.plot(x, y, clear=True) pg.QtGui.QApplication.processEvents() … Read more