pyqt4

How to create filters for QTableView in PyQt

How to create filters for QTableView in PyQt Question: I am using QTableView to display data retrieved from QtSql.QSqlQuery I want to know how can i create filters for it like in excel. In the above image i need to get the filters for All heders (Sh_Code,SH_Seq,Stage) The filters will have unique values in of …

Total answers: 4

How to choose value from an option list using PyQt4.QtWebKit

How to choose value from an option list using PyQt4.QtWebKit Question: I’m trying to auto-select a birthday from an option list on my website by using PyQt4.QtWebKit, but I’m having trouble doing this. When I want to select a radio button I do this: doc = webview.page().mainFrame().documentElement() g = doc.findFirst("input[id=gender]") g.setAttribute("checked", "true") Or set some …

Total answers: 2

QIcon.fromTheme not displaying icon in PyQt

QIcon.fromTheme not displaying icon in PyQt Question: I am having troubles to display the icon of a QAction selected from the current icon theme. I made the ui with Qt designer and exported it with pyuic4 sample.ui > sample.py. After setting the icon from the theme with self.actionSample.setIcon(QtGui.QIcon.fromTheme(_fromUtf8(“document-open”))), I get the following source code : …

Total answers: 2

How to embed matplotlib in pyqt – for Dummies

How to embed matplotlib in pyqt – for Dummies Question: I am currently trying to embed a graph I want to plot in a pyqt4 user interface I designed. As I am almost completely new to programming – I do not get how people did the embedding in the examples I found – this one …

Total answers: 3

PyQt4: combine textChanged and editingFinished for QLineEdit

PyQt4: combine textChanged and editingFinished for QLineEdit Question: Is there a way to combine textChanged and editingFinished for QLineEdit? The problem is that editingFinished is emitted even if I only move the cursor away from QLineEdit without any changes. Whereas I want to emit a signal only when any changes were performed after I finished …

Total answers: 2

How to make a PyQT4 window jump to the front?

How to make a PyQT4 window jump to the front? Question: I want to make a PyQT4 window(QtGui.QMainWindow) jump to the front when the application received a specified message from another machine. Usually the window is minimized. I tried the raise_() and show() method but it doesn’t work. Asked By: redice || Source Answers: This …

Total answers: 6

Embedding IPython Qt console in a PyQt application

Embedding IPython Qt console in a PyQt application Question: I’d like to embed an IPython qt console widget in a PyQt application I am working on. The code provided below (and adapted from https://stackoverflow.com/a/9796491/1332492) Accomplishes this for IPython v0.12. However, this crashes in IPython v0.13 at the line self.heartbeat.start() with RuntimeError: threads can only be …

Total answers: 6

how to make qmenu item checkable pyqt4 python

how to make qmenu item checkable pyqt4 python Question: How can i make my qmenu checkable? from PyQt4 import QtGui app = QtGui.QApplication([]) menu = QtGui.QMenu() menu.addAction(‘50%’) menu.addAction(‘100%’) menu.addAction(‘200%’) menu.addAction(‘400%’) menu.show() app.exec_() Asked By: unice || Source Answers: like this: from PyQt4 import QtGui app = QtGui.QApplication([]) w = QtGui.QMainWindow() menu = QtGui.QMenu(“menu”, w) menu.addAction(QtGui.QAction(‘50%’, …

Total answers: 3

PySide / PyQt detect if user trying to close window

PySide / PyQt detect if user trying to close window Question: is there a way to detect if user trying to close window? For example, in Tkinter we can do something like this: def exit_dialog(): #do stuff pass root = Tk() root.protocol(“WM_DELETE_WINDOW”, exit_dialog) root.mainloop() Thanks. Asked By: SaulTigh || Source Answers: Override the closeEvent method …

Total answers: 2

Python – Adding a Tkinter Graph to a PyQt Widget

Python – Adding a Tkinter Graph to a PyQt Widget Question: We currently have a fully functional Gui written created using PyQt. My partner wrote a function that graphs a dataSet in Tkinter. My question is, how do we combine the two so they work together? Here is the graphing function: def createGraph(self): import tkinter …

Total answers: 2