pyqt

This code for creating a QPolygon in Pyqt is stopping my application! Help?

HI all, The following code: self.painter = QtGui.QPainter(self) self.painter.setRenderHint(QPainter.Antialiasing) self.painter.translate(482,395) self.painter.scale(300,300) self.painter.save() needle = Qt.QPolygon([QPoint(30, 0), QPoint(-30, 0), QPoint(0, 200)]) self.painter.setBrush(Qt.cyan) self.painter.setPen(Qt.black) self.painter...

Is there a way to call a function right before a PyQt application ends?

I am collecting usage stats for my applications which include how much each session lasts. However, I can't seem to be able to save this information because None Of the signals I tried yet actually succeeds to call my report_session function. This are the signals I have already tried: lastWindowClosed() aboutToQuit() destroyed() Ei...

Set producer value for PDFs created by QPrinter

I'm currently producing PDFs using python and PyQT. I'd like to change the "Producer" value of the PDF's document information, currently it is set to "Qt 4.6.2 (C) 2010 Nokia Corporation and/or its subsidiary(-ies)". I've looked through the QPrinter reference, and nothing obvious stuck out that I could set. How do I change the docum...

Read the print values of an imported class

This is probably very basic, but it's giving me a headache, and I'm not sure what method to even approach it with, making the googling tough. If I have a class in a module that I'm importing with various prints throughout, how can I read the prints as they come so that I may output them to a PyQT text label? class Worker(QtCore.QThread...

PyQT and threads

I am developing an application that uses multiple threads to gather data from a variety of network devices. I'm using PyQT to display the collected data on a GUI. I am using regular python threads (from thread, threading) in my app (instead of QThread). In order to update the GUI on the different threads, I use a lock (thread.allocate_l...

how to prevent QTableModel from updating table depending on some condition

hello , i have a mysql tables that uses lock-write mechanism. the lock might go for too long (we're talking about 1-2 minutes here). i had to make a check if the table is in use or not before the update is done (using beforeUpdate signal) but after checking and returning that my table is in use , system hang until the other user unl...

Mouseover event filter for a PyQT Label

I've been trying to convert the example here to work with a simple label. Here's the code: class mouseoverEvent(QtCore.QObject): def __init__(self, parent): super(mouseoverEvent, self).__init__(parent) def eventFilter(self, object, event): if event.type() == QtCore.QEvent.MouseMove: print "mousemove...

Qt Tab widget that wraps its menu bar

When the menu of a QTabWidget grows beyond its width, the default behaviour is to turn the tab menu into a horizontaly scrollable list. What I'd prefer is to wrap the menu round so you now have two rows of tabs. This style is used on some Windows dialogs. I can't find any way to do this though. Is anyone aware of a trick or option to al...

Caching external javascript for a QtWebkit widget in a PyQt app

I have a QWebView in my app which renders a html page stored in the app as a Qresource. This page, however requires meaty external Javascript libraries such as MathJax, which I would want to include as a resource due to its size. My problem is that it seems that QtWebkit does not cache these files as a regular browser would do, and eve...

Reload a subclassed QFrame in PyQT

I have a subclassed QFrame that generates a list of buttons when my project loads, and at times, I want to be able to completely destroy and rebuild "buttonGrid". Rather than add a button in the proper spot with the proper geometry settings etc. I figured it'd be easiest to destroy this and then call it again as it was originally one. ...

PyQT4 and Ctrl C

I have a programs that runs several threads (on a while loop until Ctrl C is pressed). The app also has a GUI that I developed in PyQt. However, I am facing the following problem: If I press Ctrl C on the console, and then close the GUI, the program exits fine. However, if I close the GUI first, the other threads won't stop and the prog...

Basic Widget Interaction with PyQt

Hi, Please can someone tell me what im doing wrong here with respect to calling pwTxt.text. #!/usr/bin/python import sys from PyQt4 import QtCore, QtGui from mainwindow import Ui_MainWindow class MyForm(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_MainWind...

How to connect pyqtSignal between classes in PyQT

Hello. I'd like to ask you for an advice. How to connect pyqtSignal between two different objects (classes) PROPERLY? I mean best practice. Look what I have done to achieve the goal: The Thermometer class is notified when Pot increases its temperature: from PyQt4 import QtCore class Pot(QtCore.QObject): temperatureRaisedSignal = Qt...

Using sqlchemy in Pyqt, is it possible?

Hi i am new to Pyqt and i am wondering if it is possible to have goodness of sqlalchemy e.g. connection pooling and managing, abstracting away all the menial low level details? ...

PyQt and QSignalMapper/lambdas - multiple signals, single slot

Hi. I have a list of actions on a menu in PyQt, one for each different feed I want to display. So I have a Y that sets the active feed to Y, Z sets it to Z, etc. (For a webcomic reading program). I have each on the menu, and felt that an automated approach might be better; rather than typing out each time. Something like a function tha...

PyQt QTableWidget keyboard events while editing

I want to navigate QTableWidget in a similar way to MS Excel. e.g. When the user presses the right arrow key while editing a cell, the editing will finish and the next cell to the right will be selected. I have searched the Qt docs, but can't seem to find out how. Can anyone hep? Thanks. ...

Is it possible for SymPy to render LaTeX for use in a GUI?

Hello all, I am hoping to use PyQt to produce an application that will display an equation entered by the user. I had considered matplotlib, but this seems like overkill as I would only be using it to render the latex. I need to use SymPy anyway, so I was hoping there would be a way to use it to do the rendering also, preferably produc...

Capturing output from buffered StdOut program

I'm trying to capture the output of a windows program using Qt and Python. I'm starting the process with QProcess, but the problem is the output is being buffered. Unfortunately I don't have access to the source, and therefore can't flush the output. From my searching around, I found the program "Expect", but I don't know if there is...

QWebView not laying out properly

Even if I set the geometry for the QWebView it occupies the whole left over screen. Even worse if I maxmize the window, there is a gap between the two widgets Below is my code I wrote: from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.QtWebKit import * class twsearchbox(QWidget): def __init__(self): QWidge...

PyQT user authentication and customized layouts

Hi! So I'm developing an app in PyQT and I need to implement user authentification. Basically I have drawn 3 layouts (all same size window)...on login layout, one layout for user A and one layout for user B. The the thing I want to achieve is that when user A logins he gets his specialized layout and so does B. And I want it to if possib...