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
14
votes
2 answers

How to combine OpenCV with PyQt to create a simple GUI?

I need to perform lot of operations on an image. So I used OpenCV. OpenCV is very efficient in image processing, however it is not too good to present a suitable GUI. So I decided to use PyQt to draw a custom GUI and OpenCV to process my image. I…
user3522371
14
votes
1 answer

How to use Non-Standard Custom Font with Stylesheets?

I have a PyQt4 application that is being styled by an external .qss file by using the following code: ... app = QtGui.QApplication(sys.argv) stylesheet = open('mystylesheet.qss').read() app.setStyleSheet(stylesheet) ... Normally, I would specify…
Chris Aung
  • 9,152
  • 33
  • 82
  • 127
14
votes
6 answers

Drag and drop rows within QTableWidget

Goal My goal is to have a QTableWidget in which the user can drag/drop rows internally. That is, the user can drag and drop one entire row, moving it up or down in the table to a different location in between two other rows. The goal is illustrated…
eric
  • 7,142
  • 12
  • 72
  • 138
14
votes
1 answer

How to create a modal window in pyqt?

I looked into the documentation and i found 'self.setWindowModality(QtCore.Qt.WindowModal)'. I added this function to my 'init' function, but however still was not able to create a modal dialog box. Any help will be appreciated, Thank You.
user3135832
  • 191
  • 1
  • 1
  • 8
14
votes
4 answers

PyQt: app.exec_() stops all following code from running

I have a code which looks like: app = QApplication(sys.argv) self.interface = Interface() # The figure self.fig = self.interface.fig self.ax = self.fig.add_subplot(111) self.interface.show() app.exec_() print 'this is not printed' The problem is…
cgf
  • 3,369
  • 7
  • 45
  • 65
14
votes
1 answer

How do I use promote to in Qt Designer in pyqt4?

In the designer when I right click a widget, and I click promote to I get this window. See the screenshot below. I have never used this feature. Basically, the header file is confusing me. What is it for? Does that mean I can create a new class in…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
14
votes
6 answers

PyQt - simplest working example of a combobox inside QTableView

Background: I cannot find a full working example of a combobox inside a QTableView. So I wrote this code based on several other more contrived examples out there. The problem is, however, that this example requires you to double-click on the…
user2120303
  • 255
  • 2
  • 4
  • 8
14
votes
3 answers

Get rid of Qt's dotted outline on QListView items

I'm trying to remove the dotted border on the text in this QListView::item using stylesheets: I've tried variations of border: 0 and show-decoration-selected: 0 on QListView, QListView::item and QListView::item::text to no effect. I'm using PyQt,…
Ross
  • 46,186
  • 39
  • 120
  • 173
14
votes
4 answers

PyQt: clicking X doesn't trigger closeEvent

I'm a total newbie in PyQt trying to develop simple application. I have designed simple ui with Qt-designer. I want extra confirmation if the user really want to exit application when clicking X or ,,Exit'' button or choosing Exit from menu. Here's…
Wookie88
  • 33,079
  • 4
  • 27
  • 32
14
votes
2 answers

How to set the default item of a QComboBox

In my function I have dictionary with empty values: self.items = { 'Maya Executable': '', 'Render': '', 'Mayapy Interpreter': '', 'imgcvt': '', 'IMConvert': '', } How should I set "Maya Executable" (i.e. the 0th key) as the QComboBox's default item…
user1176501
13
votes
2 answers

PyQt: Trying to understand graphics scene/view

I'm trying to make sense of QGraphicsView and QGraphicsScene, specifically how to place graphics items and have them appear where I want them to. I'm also confused about when scroll bars will appear if the scene is larger than the viewing area. For…
XandYandZ
  • 283
  • 1
  • 3
  • 9
13
votes
2 answers

xvfb run error in ubuntu 11.04

My task is crawling the google search results using headless webkit(PyQt4.QtWebkit) in python. The module was crawling the results fine using PyQt4.I should have to execute this script in amazon ec2.So,I should have to use Xvfb (no x server in…
Nava
  • 6,276
  • 6
  • 44
  • 68
13
votes
3 answers

PyQt4: QSpinBox doesn't accept values higher than 100

I am quite new to python and qt, i want to use a spinner that ranges from 0 - 1000000 but the QSpinBox wont go above 100 even when i set the max to be 1000000, i am sure it is really simple to do, bu i have been searching for ages and cannot find…
Ben
  • 131
  • 1
  • 1
  • 3
13
votes
3 answers

Connecting slots and signals in PyQt4 in a loop

Im trying to build a calculator with PyQt4 and connecting the 'clicked()' signals from the buttons doesn't work as expected. Im creating my buttons for the numbers inside a for loop where i try to connect them afterwards. def __init__(self): for…
lukad
  • 17,287
  • 3
  • 36
  • 53
13
votes
1 answer

What is the necessity of sys.exit(app.exec_()) in PyQt?

I have this code, that works just fine: import sys from PyQt4 import QtGui def main_window(): app = QtGui.QApplication(sys.argv) screen = QtGui.QDesktopWidget().screenGeometry() widget = QtGui.QWidget() …
Amir Shabani
  • 3,857
  • 6
  • 30
  • 67