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
29
votes
7 answers

How can I change the cursor shape with PyQt?

I have a simple application that runs a process that can last for several minutes before completing. I am trying to provide an indication to the user that it is processing the request - such as changing the cursor to an hourglass. But I cannot…
TimothyAWiseman
  • 14,385
  • 12
  • 40
  • 47
27
votes
3 answers

QWidget::setLayout: Attempting to set QLayout "" on MainWindow "", which already has a layout

I'm making an application in PyQt4 and this is my code so far: import sys from PyQt4 import QtGui, QtCore class MainWindow(QtGui.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.initUi() def…
WewLad
  • 717
  • 2
  • 11
  • 22
27
votes
5 answers

ImportError: No module named PyQt4

I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that "No module named PyQt4". Can somebody help me with that?
Win83
  • 277
  • 1
  • 3
  • 3
26
votes
6 answers

how to make a cell in a QTableWidget read only?

i have the following code defining the gui of my app class Ui (object): def setupUi(): self.tableName = QtGui.QTableWidget(self.layoutWidget_20) self.tableName.setObjectName(_fromUtf8("twHistoricoDisciplinas")) …
Rafael Rotelok
  • 1,102
  • 1
  • 14
  • 26
26
votes
1 answer

PyQT: how to open new window

First of all, similar questions have been answered before, yet I need some help with this one. I have a window which contains one button (Class First) and I want on pressed, a second blank window to be appeared (Class Second). I fiddled with the…
user3060854
  • 923
  • 2
  • 15
  • 25
25
votes
3 answers

PyQt4 File select widget

I want to make a QT4 (using QT designer) dialog, that contains a part where a file has to be selected. Now, I know QFileDialog exists, and I can program something that does what I want. But can I also just do it in QT designer? Is there some way to…
Nathan
  • 515
  • 2
  • 7
  • 14
25
votes
7 answers

Python PyQt4 functions to save and restore UI widget values?

Before I attempt to write my own Python PyQt4 module functions... I wanted to ask if anyone has such a function to share. In many of my python programs where I have a GUI built using PyQt4 and qtDesigner, I use the QSettings method to save and…
panofish
  • 7,578
  • 13
  • 55
  • 96
23
votes
4 answers

Terminal in broken state (invisible text / no echo) after exit() during input() / raw_input()

I've been writing a small utility application using Python 3 (the below testcase also works in Python 2, however) and PyQt 4 that uses the code module to spawn a REPL prompt allowing interaction with a Qt window. Unfortunately I've hit a problem…
Sho
  • 231
  • 2
  • 4
23
votes
7 answers

PyQt4 Minimize to Tray

Is there a way to minimize to tray in PyQt4? I've already worked with the QSystemTrayIcon class, but now I would like to minimize or "hide" my app window, and show only the tray icon. Has anybody done this? Any direction would be appreciated. Using…
Gavin Vickery
  • 303
  • 1
  • 3
  • 9
23
votes
6 answers

PyQt4: How do you iterate all items in a QListWidget

Currently, I use the following while loop in a class that inherits QtGui.QListWidget to iterate all items: i = 0 while i < self.count(): item = self.item(i) i += 1 I was hoping I could use: for item in self.items(): but…
Michael Allan Jackson
  • 4,217
  • 3
  • 35
  • 45
23
votes
3 answers

Importing resource file to PyQt code?

I have seen Qt documentary and a lot of questions less-similar to this one, But i still haven't figured out how can i do it. I'm not entirely sure how can i import resource file to Python code, so pixmap appears without any issues. I have all files…
ShellRox
  • 2,532
  • 6
  • 42
  • 90
23
votes
3 answers

How to enable Pan and Zoom in a QGraphicsView

I am using python and Qt Designer to implement loading tiff images and to enable Pan and Zoom on some mouse event (wheel - zoom, press wheel - pan). I was looking into some options and classes that can work with images etc, and so far I have found:…
milutinke
  • 401
  • 1
  • 4
  • 13
23
votes
7 answers

Fastest way to populate QTableView from Pandas data frame

I'm very new to PyQt and I am struggling to populate a QTableView control. My code is the following: def data_frame_to_ui(self, data_frame): """ Displays a pandas data frame into the GUI """ list_model =…
Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68
23
votes
2 answers

clickable event on QLabel in python using pyqt4?

I am working in python GUI using pyqt4 library and new with signal and slots. I don't know how to put event on label name QPLabel. Here is my code : class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) …
Zeb
  • 2,687
  • 7
  • 28
  • 36
23
votes
2 answers

How to restrict user input in QLineEdit in pyqt

I have a QLineEdit and i want to restrict QLineEdit to accept only integers. It should work like inputmask. But I dont want to use inputmask, because if user clicks on QLineEdit cursor will be at the position where mouse was clicked. and user need…
Rao
  • 2,902
  • 14
  • 52
  • 70