Questions tagged [pyqt4]

PyQt is a set of Python bindings for Qt application framework and runs on all platforms supported by Qt including Windows, MacOS/X and Linux.

PyQt is developed by Riverbank Computing.

It is available on all platforms under a variety of licenses including the GNU GPL (v2 and v3) and a commercial license.

Unlike Qt, PyQt v4 is not available under the LGPL.

5631 questions
17
votes
4 answers

How do I output a colormap in a scene using pyqt?

TL;DR: You only need to read the "Update" section. How do you output numpy.random.random((256, 256)) as a colormap to a qt scene? That's the summary of the summary. Update: The following gets me the colormap I want saved to file. scaled_image…
Frikster
  • 2,755
  • 5
  • 37
  • 71
17
votes
1 answer

PyQt messagebox yes or no with an if

So guys.What I want to do is, ask if user wanted to reset the form values. If yes, reset, if no, popup a messagebox.information to confirm nothing happened. def reset(self): qm = QtGui.QMessageBox qm.question(self,'', "Are you sure to reset all the…
Tian
  • 171
  • 1
  • 1
  • 4
17
votes
4 answers

How to add a row in a tableWidget PyQT?

I am currently working on a widget that was designed in Qt Designer. I am having trouble with the syntax / overall concept of trying to add a row to a Qtable in PyQT. There is no method, which I have yet found to dynamically add rows. Any…
sudobangbang
  • 1,406
  • 10
  • 32
  • 55
17
votes
5 answers

PYQT4 - How do I compile and import a qrc file into my program?

I'm having trouble importing a resource file. I'm using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like ImportError: No module named icon_rc I know that I have to compile it using…
Thomas
  • 1,199
  • 3
  • 13
  • 25
17
votes
3 answers

how to make qmenu item checkable pyqt4 python

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_()
unice
  • 2,655
  • 5
  • 43
  • 78
16
votes
3 answers

PyInstaller + UI Files - FileNotFoundError: [Errno 2] No such file or directory:

I'm trying to export my .py script to .exe using PyInstaller, which has dependencies on .ui files which were created using Qt Designer. I can confirm that my .py script works just fine when running it through PyCharm - I'm able to see the GUI I've…
giran
  • 368
  • 1
  • 2
  • 11
16
votes
1 answer

SQL Update statement but using pyodbc

I am using a pyodbc driver to connect to a microsoft access table using SQL. Does anyone know how I go about replacing fields within this table?? I have though about deleting the row and then putting the row back but that would change the primary…
MrPython
  • 239
  • 1
  • 3
  • 12
16
votes
3 answers

Proper way to handle the close button in a main window PyQt, (Red "X")

First off, I am a complete newbie to PyQt. I have been trying to link a function to the Main Window's close button (the red x in the corner of the window) but I haven't been having any success. Right now, my code looks something like this: class…
sudobangbang
  • 1,406
  • 10
  • 32
  • 55
16
votes
2 answers

PyQt QPushButton Background color

I have the follow code: self.pushButton = QtGui.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(0, 550, 150, 31)) self.pushButton.setObjectName(_fromUtf8("pushButton")) How do I get the background color of this button to change. I have…
Trying_hard
  • 8,931
  • 29
  • 62
  • 85
16
votes
2 answers

Python - PyQT4 how to detect the mouse click position anywhere in the window?

I have 1024x768 resolution window, when there is a click or mouse over, i want to find the x, y values. How can i do that? import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example,…
user285594
16
votes
3 answers

Placeholder for a custom widget

I am loading a QMainWIndow base from a *.ui file. Also, i have a custom widget i want to place somewhere on the form. Currently i put in the .ui file an empty QVBoxLayout named placeholder, and in the QMainWindow subclass do…
warvariuc
  • 57,116
  • 41
  • 173
  • 227
16
votes
1 answer

Define pyqt4 signals with a list as argument

According to http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html I can define a pyqt4-signal with takes an integer argument by mysignal = pyqtSignal(int). How can I define a signal which takes an integer and a list of strings or…
student
  • 1,636
  • 3
  • 29
  • 53
16
votes
6 answers

Focusing on a tabified QDockWidget in PyQt

I have three QDockWidgets which are tabbed at startup using QMainWindow.tabifyDockWidget. In the main window, after all of the addDockWidget calls: self.tabifyDockWidget(self.dock_widget1, self.dock_widget2) self.tabifyDockWidget(self.dock_widget1,…
brianz
  • 7,268
  • 4
  • 37
  • 44
16
votes
2 answers

PyQt4: combine textChanged and editingFinished for QLineEdit

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…
Ekaterina Mishina
  • 1,633
  • 5
  • 20
  • 23
16
votes
2 answers

PySide/PyQt - Starting a CPU intensive thread hangs the whole application

I'm trying to do a fairly common thing in my PySide GUI application: I want to delegate some CPU-Intensive task to a background thread so that my GUI stays responsive and could even display a progress indicator as the computation goes. Here is what…
user1491306
  • 163
  • 1
  • 6