pyqt

Bundling PyQwt with py2exe

I have a standard setup script for py2exe with which I bundle PyQt-based applications into Windows .exe files. Today I tried a simple script that uses the PyQwt module, and it doesn't seem to work. py2exe runs alright, but when I execute the .exe it creates, it dumps the following into a log file and doesn't run: Traceback (most recent...

Python and Qt (PyQt) - calling method before resize event

Hello, i have a question. There is application class in my program. It is inherited from QtGui.QMainWindow. In ini I call my own method which works with graphic. And it should be called before resize event. How can i do that? Thanks. EDIT: As you can se here the value of resize event is 14, and show event is 17. So i should find event w...

Python taskbar applet

I want to code up a panel that will be used both in Linux and Windows. Ideally it will be written in Python using PyQT. What I've found so far is the QSystemTrayIcon widget, and while that is quite useful, that's not quite what I'm looking for. That widget lets you attach a menu to the left and right clicks of an icon on the system tray...

PyQt sending parameter to slot when connecting to a signal

I have a taskbar menu that when clicked is connected to a slot that gets the trigger event. Now the problem is that I want to know which menu item was clicked, but I don't know how to send that information to the function connected to. Here is the used to connect the action to the function: QtCore.QObject.connect(menuAction, 'triggered(...

QListView/QListWidget with custom items

I'm writing my first Qt application with PyQt and am having some trouble creating a custom list view. I'd like the list to contain arbitrary widgets (one custom widget in particular). How would I go about this? It seems that the alternative would be to create a table or grid view wrapped in a scrollbar. However, I'd like to be able t...

PyQt - QLabel inheriting

Hello, i wanna inherit QLabel to add there click event processing. I'm trying this code: class NewLabel(QtGui.QLabel): def __init__(self, parent): QtGui.QLabel.__init__(self, parent) def clickEvent(self, event): print 'Label clicked!' But after clicking I have no line 'Label clicked!' EDIT: Okay, now I'm usi...

select GUI on windows (wxPy vs pyQt)

Hello! We are plan to create an application for monitoring and configuring our service (which is running on remote server). After long time discuss, we decide for python as pl for our app, because we love and know python (better, than english, really). but we don't know, what GUI toolkit preffered for our aims. We need fast (for develop...

Phonon and image support

I'm trying to build a simple slideshow-like effect using Phonon with PyQt. The "slideshow" will be made up of images and/or video, but the images should display for some fixed period of time. When I queue up an image in a MediaSource, it is displayed for only a short moment. Phonon appears to support images via the backend (at least o...

Showing progress of python's XML parser when loading a huge file

Im using Python's built in XML parser to load a 1.5 gig XML file and it takes all day. from xml.dom import minidom xmldoc = minidom.parse('events.xml') I need to know how to get inside that and measure its progress so I can show a progress bar. any ideas? minidom has another method called parseString() that returns a DOM tree assumi...

Stealing wheelEvents from a QScrollArea

I wanna put my custom widget in a QScrollArea, but in my custom widget, i reimplemented wheelEvent(e) and it never gets called. Im fine with the scroll area not having its mouse wheel scrolling functionality, I just need those wheelEvents to call my handler. I tried handling the events out at the level of the main window but I only got t...

Logging All Exceptions in a pyqt4 app

What's the best way to log all of the exceptions in a pyqt4 application using the standard python logging api? I've tried wrapping exec_() in a try, except block, and logging the exceptions from that, but it only logs exceptions from the initialization of the app. As a temporary solution, I wrapped the most important methods in try, ex...

"Python.exe" crashes when PyQt's setPixmap() is called with a Pixmap

I have a program that sends and receives images to each other using sockets. The server sends the image data using 'image.tostring()' and the client side receives it and turns it back into an image using 'Image.fromstring', then into a QImage using 'ImageQt.ImageQt(image)', turns it into a QPixmap using 'QPixmap.fromimage(qimage)'then up...

Pure python gui library?

Hello. Python has a lot of gui librarys: tknter, wxWidgets, pyGTK etc. But all this gui needs to be installed and quite heavyweight, so it's a bit complex to deploy end-user gui python apps that relay on mentioned gui librarys. Recently, i have thinked about python build-in ctypes. Theoretically, it's possible to create pure python gui...

Playing MMS streams within Python

I'm writing a XM desktop application (I plan on releasing the source on github when I'm finished if anyone is interested) Anyway, the one part I know very little about is how to play media within Python (I'm using PyQt for the frontend). Basically, I have a mms:// url that I need to play. I was wondering if there is a library that could ...

PyQt clipboard doesn't copy to system clipboard

The following snippet of code doesn't seem to affect the system clipboard at all: clipboard = QtGui.QApplication.clipboard() clipboard.setText(text) According to the Qt documentation, this is how you copy text to clipboard, Why isn't it working? Googling turned this up. It suggests adding this after the above code: event = QtCore...

What is a role in a QTreeWidgetItem?

I have a QTreeWidget with several Columns; I add QTreeWidgetItems to it. I try to make the second column contain a numerical value for each Item so I can sort the items by this value QTreeWidgetItem has a method called setData(int column, int role, QVariant(data)) I cannot find any documentation on what this role argument is. All I kn...

PyQT: QTableWidget.setItemPrototype not working?

In a QTableWidget i want to display all values only with two decimals places. For that I subclassed QTableWidgetItem. class MyCell(QTableWidgetItem): def __init__(self, *args): QTableWidgetItem.__init__(self, *args) def clone(self): return MyCell() def data(self, role): t = QTableWidgetItem(self).da...

Play mp3 using Python, PyQt, and Phonon

I been trying all day to figure out the Qt's Phonon library with Python. My long term goal is to see if I could get it to play a mms:// stream, but since I can't find an implementation of this done anywhere, I will figure that part out myself. (figured I'd put it out there if anyone knew more about this specifically, if not no big deal...

Developing user interface in Python - TkInter Vs PyQt

Hi If one wants to develop a user interface in Python, which one to go for: TkInter or PyQt. I just started with TkInter and I was able to get some simple UIs going with elementary widgets like label, button, text box etc. Just curious to know how good PyQt would be compared to TkInter? cheers ...

Create PyQt menu from a list of strings

I have a list of strings and want to create a menu entry for each of those strings. When the user clicks on one of the entries, always the same function shall be called with the string as an argument. After some trying and research I came up with something like this: import sys from PyQt4 import QtGui, QtCore class MainWindow(QtGui.QMa...