pyqt4

How can I add a Picture to a QWidget in PyQt4

How can I add or import a picture to a QWidget? I have found a clue. I can add a Label and add a Picture in that label. I need the arguments for the QPicture(). The probable I can use is, QLabel.setPicture(self.QPicture). ...

PyQt4: Hide widget and resize window

Hi everyone: I'm working with several widgets but the solution just won't come out. What I have is a series of buttons in series of QHBoxLayouts. Some buttons are hidden by default, but they will appear when needed. To solve space issues, all buttons have a minimum and maximum size so they always look well packed. Also I have a QTextEdi...

QWebView not loading external resources

Hi. I'm working on a kiosk web browser using Qt and PyQt4. QWebView seems to work quite well except for one quirk. If a URL fails to load for any reason, I want to redirect the user to a custom error page. I've done this using the loadFinished() signal to check the result, and change the URL to the custom page if necessary using QWebVi...

how to sort a QTableWidget with my own code?

Hi, I am using Qt4.5.2 on Linux. I have a simple QTableWidget, in which a column displays dates in a human-friendly format. Unfortunately "human-friendly dates" are not easy to sort correctly. So, in the QTableWidget I keep a hidden column with the UNIX timestamp corresponding to that date. I am trying to make sure that, whenever a req...

How do I get my python object back from a QVariant in PyQt4?

I am creating a subclass of QAbstractItemModel to be displayed in an QTreeView. My index() and parent() function creates the QModelIndex using the QAbstractItemModel inherited function createIndex and providing it the row, column, and data needed. Here, for testing purposes, data is a Python string. class TestModel(QAbstractItemModel):...

PyQt4: Adding QtMessageBox.information functionality to custom window

Hi everyone, what I need is something very alike QtMessageBox.information method, but I need it form my custom window. I need a one window with few labels, one QtTreeViewWidget, one QButtonGroup … This window will be called from main window. If we call class that implements called window as SelectionWindow, than what I need is: class ...

pyqt signal problem

Hi! I'm working on a plugin for Avogadro (chemistry software) that uses pyqt. I've some problem with connecting a method to the clicked signal of a button. I've my class: class Controller(object): def __init__(self): self.ui = MyDialog() # self.ui.run is a QPushButton self.ui.run.clicked.connect(self.on_run_click) ...

Using PyQt4 - QTableView with SQLAlchemy using QSqlTableModel (or not)

Hi everyone, i'm starting to learn Qt for python and as i was wondering after reading this post : qt - pyqt QTableView not populating when changing databases. if there was a way to use SQLAlchemy sessions instead of (re-)opening a database connection as a Table Model with Qt's QTableView widget. Something that would work a little bit l...

Python + QT + Gstreamer

Hi everyone, I'm working with PyQt and trying to get video from a webcam to play within a QT widget. I've found tutorials for C and Qt, and for python and gtk, but NOTHING for this combo of pyQt and gstreamer. Anybody get this working? This plays the video fine, but in a separate window: self.gcam = gst.parse_launch('v4l2src devic...

Applying style sheets in pyqt

Hello all, If i apply a property to a parent widget it is automatically applied for child widgets too.. Is there any way of preventing this?? For example if i set background color as white in a dialog the button,combo boxes and scroll bars looks white as it lacks it native look(have to say it's unpleasant & ugly).. Is there any way that...

How to stop a QDialog from executing while still in the __init__ statement(or immediatly after)?

I am wondering how I can go about stopping a dialog from opening if certain conditions are met in its __init__ statement. The following code tries to call the 'self.close()' function and it does, but (I'm assuming) since the dialog has not yet started its event loop, that it doesn't trigger the close event? So is there another way to c...

pdf viewer for pyqt4 application?

Hi all, I'm writing a Python+Qt4 application that would ideally need to pop up a window every once in a while, to display pdf documents and allow very basic operations, namely scrolling through the different pages and printing the document. I've found the reportLab to create pdf files, but nothing about pdf viewers. Does anyone knows a...

PyQt4 Custom Widgets

Are there any good PyQt4 custom widgets like at Qt-Apps.org? I would like to start making PyQt custom widgets but online resources that I find don't seem to be clear For example, Trolltech's and Zetcode's don't seem to be related in any way at all. Thanks for any input :) ...

Label in PyQt4 GUI not updating with every loop of FOR loop

I'm having a problem, where I wish to run several command line functions from a python program using a GUI. I don't know if my problem is specific to PyQt4 or if it has to do with my bad use of python code. What I wish to do is have a label on my GUI change its text value to inform the user which command is being executed. My problem h...

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 use as a newbie (since you can see all the attributes/properties/defaults etc) of each w...

Python: Dynamic attribute name generation without exec() or eval()

Hi, I'm trying to dynamically create buttons at runtime with PyQT4.7 However, this being my first python program I'm not sure how to get the functionality I want. I would like to be able to substitute a text string for an attribute name: i.e. for each in xrange(4): myname = "tab1_button%s" % each #tab1_button0, tab1_button1, ...

have you got a py-poppler-qt example?

Hello everybody, I'm developing an application in PyQt4 that eventually has to open and show PDF files. For this task there is a python library: python-poppler (in various spelling flavours). The problem is that it is terribly under documented and the only simple working example I found so far uses Python+Gtk+Cairo, while the example ...

Latitude/Longitude Qt4 widget?

What is the best starting point for a Qt4 widget for entering Latitude/Longitude in DD:MM:SS format (degrees, minutes, seconds)? Customize a QLineEdit? A series of spin boxes? ...

PyQt4.QtWebKit.QWebFrame missing findAllElements() method on debian

I recompiled PyQt4 from source, but the issue still exists. On another ArchLinux system, it works well. Can someone help me? Thanks! on Debian: >>> import PyQt4.QtWebKit >>> dir(PyQt4.QtWebKit.QWebFrame.findAllElements) Traceback (most recent call last): File "", line 1, in AttributeError: type object 'QWebFrame' has no attribute ...

Supported Audio Formats of Qt4 Phonon?

I am making a music player in PyQt4, and I am using Phonon to play the music itself. This application is aimed primarily at Windows, but I plan on also supporting Mac and Linux versions. What I want to know is which audio formats are supported by Phonon so that I can ensure that the user only enters those files. ...