pyqt4

dropEvent not being called on custom view in PyQt4?

I'm trying to create a custom QTableView that will respond to drag and drop actions. So far, I have something like the following: from PyQt4.QtCore import * from PyQt4.QtGui import * class FooTableView(QTableView): def __init__(self, parent = None): QTableView.__init__(self, parent) self.setAcceptDrops(True) d...

adding a header to pyqt list

hello i want to add a headers and index to a list in pyqt , it's really not important what list of QT (qlistwidget , qlistview , qtablewidget, qtreeview) in short .. i want something like the spin box delegate example in the pyqt demo ... but instead of the index in the column headers i want a strings ... hope the idea is clear en...

Make qwidget in new window in PyQt4

I'm trying to make a class that extends qwidget, that pops up a new window, I must be missing something fundamental, class NewQuery(QtGui.QWidget): def __init__(self, parent): QtGui.QMainWindow.__init__(self,parent) self.setWindowTitle('Add New Query') grid = QtGui.QGridLayout() label = QtGui.QLabel('blah') grid.addWidget(la...

Python GUI Scraper hanging issues.

I wrote a scraper using python a while back, and it worked fine in the command line. I have made a GUI for the application now, but I am having trouble with one issue. When I attempt to update text inside the gui (e.g. 'fetching URL 12/50'), I am unable seeing as the function within the scraper is grabbing 100+ links. Also when going ...

getting keyboard events with pyqt

hello i converted recently from wxpython to pyqt and im still facing alot of problems since im still noob in pyqt so is it possible to detected if user pressed (CTRL+key ) in pyqt ? and how ? i've been trying to find an answer for this for 3 days . if you know website or a good place to learn pyqt, it will be highly appreciated t...

Periodically updating data in a matplotlib figure embedded in a QWidget

I have a thread that updates some data periodically. I want do visualize the data with matplotlib. When the thread updates the data, the plot should be updated as well. I tried embedding a matplotlib.FigureCanvas(see following snippet) in a QWidget... class MplSubPlotCanvas(FigureCanvas): def __init__(self, parent=None): se...

Accessing an image from a webpage in PyQt4 QtWebkit

If a page has fully loaded on a QWebView, how can I get the data for a certain image (probably through the dom?) ...

PyQt4: Why does Python crash on close when using QTreeWidgetItem?

I'm using Python 3.1.1 and PyQt4 (not sure how to get that version number?). Python is crashing whenever I exit my application. I've seen this before as a garbage collection issue, but this time I'm not sure how to correct the problem. This code crashes: import sys from PyQt4 import QtGui class MyWindow(QtGui.QMainWindow): def __...

changing cell background color in qt

hello .. i'm new to pyqt , and i'm still facing some newbie problems :D i have a QTableWidget that is item delegated on a QChoice control ( hope i said it right ) i need to have the cell background color changes whenever a user change the choice control selection briefly: how to change a cell background color in a table widget ?? i...

Which button was clicked?

How can I detect which mouse button was clicked (right or left) in the slot for QtCore.SIGNAL('cellClicked(int,int)')? ...

PyImport_ImportModule("PyQt4.QtGui") fails

I've got a C++ windows app that is trying to load a PyQt4 object, similar to the way PyQt4 does it for providing python widgets in the QtDesigner. The app loads other Python modules just fine, but fails to load PyQt4.QtGui. Also, with straight Python, I can load PyQt4.QtGui just fine. The debug output when it attempts that is: 'devenv.e...

Communication between threads in PySide

Hello, I have a thread which produces some data (a python list) and which shall be available for a widget that will read and display the data in the main thread. Actually, I'm using QMutex to provide access to the data, in this way: class Thread(QThread): def get_data(self): QMutexLock(self.mutex) return deepcopy(self.data) ...

QWebFrame::evaluateJavaScript vs. script-tag in HTML

Hi, I want to develop an application that uses QtWebKit and JQuery. What I need to know is, is there any difference between reading JQuery from a file and evaluateJavaScript it, or embedding it as a script tag within the "page" that is displayed within the widget? EDIT: It seems that I have this figured out at least partially. evalua...

Can't get flat QToolButton with border on hover stylesheet

Hi, all! I need to implement textbox with inplace button (for search or filter purposes). So, I need to get Qtoolbutton, that is flat and rendered as icon, and obtain the border when hovered by mouse or pressed. And maybe I'd add some almost transparent background on hover too. I tried to set the following stylesheet: 'border: none;...

Crossfading audio with PyQT4 and Phonon

I'm trying to get audio files to crossfade with phonon. I'm using PyQT4. I have tracks queuing properly, but I'm stuck with the fade effect. I think I need to be using the KVolumeFader effect. Here's my current code: def music_play(self): self.delayedInit() self.m_media.setCurrentSource(Phonon.MediaSource(self.playlist[self....

QT Question - What are all these extra spaces for ? (pic provided)

stack overflow wont let me post images so heres the link: http://4m0.org/images/qt.png This is my application. For this question, ignore the top part with the buttons. I have a QScrollArea Filled with many QGroupBoxes Filled with a horizontal box layout of QLabel (on the left) and QGroupBox (on the right) The right side is a vertic...

Py2exe, PyQt4 and Postgre Driver (QPSQL)

Hi, I`m trying to freeze my application using Py2exe. My app uses PyQt4 and it apparently works fine with py2exe. But once I`ve uninstalled PyQt, it shows the following error: QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QPSQL7 QPSQL Which doesn't make any sense at all. The driver is available, but I can't us...

clicked() signal for QListView in PyQt4

I have a working QListView, but from the documentation, I can't figure out how to get a signal to fire with the index of the newly selected item. Any ideas? ...

Track window/control resize in PyQt?

I have a window with 2 QTableWidgets, having their scrolling synchronized. The 1st one usually has horizontal scroll, while the 2nd usually (automatically) not. In order for them to show consistent data (row against row) I make the 2nd have the scroll (through property HorizontalScrollBar -> AlwaysOn). But sometimes the 1st table doesn'...

Recognition source of event in PyQT

Hi, I`m starting with PyQt4 and right now I have a problem with events. I have one main class let say MainWindow. MainWindow has a list of buttons of type ButtonX (inherence form QPushButton). I would like to achieve one of 2 solutions (depends which is easier). 1) After click one of the button from the list I would like to run a one m...