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
23
votes
6 answers

How to make a PyQT4 window jump to the front?

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.
redice
  • 8,437
  • 9
  • 32
  • 41
22
votes
2 answers

Qt correct way to show/display/raise window

Quite often I find that I need to show and bring a window to a front. For example when the user attempts to reload the same document I simply bring up the old one. To do this I have code like…
edA-qa mort-ora-y
  • 30,295
  • 39
  • 137
  • 267
22
votes
5 answers

Equivalent to time.sleep for a PyQt application

I can't use time.sleep in my pyqt application because that freezes the GUI thread, so the GUI will be completely frozen during this time.I have been looking for a way to handle this. I tried to use QTimer, but it seemed like they need to be linked…
PAR
  • 624
  • 1
  • 5
  • 16
22
votes
2 answers

How to install PyQt on Ubuntu 12.04 with python 2.7?

There may be some similar questions like this one, but I didn't find any answer for me. I tried some ways to do it like: sudo aptitude install python-qt4-dev python-sip4 python-sip4-dev from:…
bandit
  • 839
  • 4
  • 10
  • 26
22
votes
1 answer

replacing layout on a QWidget with another layout

I have a widget which changes when an option is toggled. This invalidates all layouts and widgets. I keep list of all layouts, so I can delete them using something similar to this answer: class MyWidget(QFrame): # ... def reLayout(self): …
eudoxos
  • 18,545
  • 10
  • 61
  • 110
21
votes
7 answers

QMainWindow with only QDockWidgets and no central widget

We have a window with several components in QDockWidgets. Ideally, we'd like to have all components dockable, but there is one component that will likely always be visible. So we made that the central widget. However, this does not allow us to…
Ivo
  • 3,481
  • 1
  • 25
  • 29
21
votes
2 answers

Get a layout's widgets in PyQT

I have a QVBoxLayout that I've added a few widgets to, via addWidget(). I need to now delete those widgets, and it seems I need to use removeWidget() (which takes in a widget to be removed) to do that. I thought that calling children() or…
Xiong Chiamiov
  • 13,076
  • 9
  • 63
  • 101
21
votes
2 answers

Building executables for Python 3 and PyQt

I built a rather simple application in Python 3.1 using PyQt4. Being done, I want the application to be distributed to computers without either of those installed. I almost exclusively care about Windows platforms, so my goal is to have a single…
21
votes
3 answers

How to stop a QThread from the GUI

This is a follow up question to a previous one I posted earlier. The problem is how to stop (terminate|quit|exit) a QThread from the GUI when using the recommended method of NOT subclassing Qthread, but rather vreating a QObject and then moving it…
stefano
  • 769
  • 2
  • 10
  • 24
20
votes
1 answer

Qt - How to get the pixel length of a string in a QLabel?

I have a QLabel of a fixed width. I need to check (periodically) that the entire string fits inside the QLabel at its current width, so I can resize it appropriately. To do this, I need to obtain the 'pixel length' of the string. (The total amount…
Anti Earth
  • 4,671
  • 13
  • 52
  • 83
20
votes
3 answers

converting QdateTime to normal python dateTime?

I have a lot of existing code that just uses the normal dateTime class in python, however in upgrading my program I am using the QtGui.QdateTimeEdit() class, but that class returns a QdateTime object that seems to be incompatible with the normal…
Scott C
  • 325
  • 1
  • 2
  • 7
20
votes
4 answers

Hiding console window of Python GUI app with py2exe

I have a Python program uses Qt (PyQt4 in fact) and when I launch it from its main.py, I get a console window and the GUI window (on Windows, of course). Then I compile my program with py2exe and main.exe is successfully created. However, if I run…
ahmet alp balkan
  • 42,679
  • 38
  • 138
  • 214
20
votes
4 answers

Using QTDesigner with PyQT and Python 2.6

I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6 I just downloaded the whole PyQT/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to…
PyNewbie27
  • 205
  • 1
  • 2
  • 5
19
votes
1 answer

PyQt give color to a specific element

This might be an easy question, but I'm trying to give a color to a specific QLabel in my application and it doesn't work. The code I tried is the following : nom_plan_label =…
Johanna
  • 1,343
  • 4
  • 25
  • 44
19
votes
2 answers

How to apply style sheet to a custom widget in PyQt

# -*- coding: utf-8 -*- import sys from PyQt4.QtGui import * from PyQt4.QtCore import * class MainWindow(QWidget): def __init__(self): super(MainWindow, self).__init__() self.setFixedWidth(200) …
Anke_Pet
  • 354
  • 1
  • 3
  • 10