pyqt

Prototyping Qt/C++ in Python

I want to write a C++ application with Qt, but build a prototype first using Python and then gradually replace the Python code with C++. Is this the right approach, and what tools (bindings, binding generators, IDE) should I use? Ideally, everything should be available in the Ubuntu repositories so I wouldn't have to worry about incompa...

Why doesn't my QsciLexerCustom subclass work in PyQt4 using QsciScintilla?

My end goal is to get Erlang syntax highlighting in QsciScintilla using PyQt4 and Python 2.6. I'm running on Windows 7, but will also need Ubuntu support. PyQt4 is missing the necessary wrapper code for the Erlang lexer/highlighter that "base" scintilla has, so I figured I'd write a lightweight one on top of QsciLexerCustom. It's a litt...

Set bold rows in a QTreeView

I have a custom subclass of a QTreeView in a pyqt application. I'm trying to give the user the ability to highlight and "lowlight" (for lack of a better term) rows. Highlighted rows should have bold text and (optionally) a different background color. Any ideas? I'm considering StyleSheets as an option, but have so far been unable to get ...

How to set visibility for textblocks in QTextEdit?

Hi everyone, i tried to hide textblock's in QTextEdit, but it doesn't work: block = textedit.document().begin() block.setVisible(False) This code works fine for QPlainTextEdit, but not for QTextEdit. In documentation i haven't found any mention of how it should work for QTextEdit, just following: void QTextBlock::setVisible ( bo...

how code a Image button in PyQt?

Im trying to do simple audio player, but I want use a image(icon) as a pushbutton. ...

More compact layout

In the following code, I'd like to get rid of the margin around the buttons. I'd like to have the buttons stretch all the way to the edge of the frame. How can I do that? import sys from PyQt4.QtGui import * from PyQt4.QtCore import * app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() layout.setSpacing(0) window....

How does large text file viewer work? How to build a large text reader

how does large text file viewer work? I'm assuming that: Threading is used to handle the file The TextBox is updated line by line Effective memory handling is used Are these assumptions correct? if someone were to develop their own, what are the mustsand don'ts? I'm looking to implement one using a DataGrid instead of a TextBox I...

How to create list view with overlaping items in Qt

Hi everybody, I want to make a list view with possibility to draw widget like picture or set widget in rows of this list view. I need those "widgets" able to locate themselfs more than one row. I'm new in Qt and I want to know how I possibly can do this. The example of my aim is something like memos in calendar, when it displays whole...

Python + PyQt program freezes

I wrote PyQt application. After it's start I close it (GUI), but timer don't stops and Python sometimes freezes. Only thing to unfreeze it - Ctrl-C, after which following message appears: Traceback (most recent call last): File "", line 262, in timerEvent KeyboardInterrupt timer don't stops again, ...

How to create widget with clickable text in QT/PyQt?

Hi everyone, i'm trying to realize non-editable QTableView with widgets in cells that should contain clickable listed text. With following code i'm setting widget in definite cell: view = QTableView() label = QLabel( <some html text> ) ... view.setIndexWidget(index, label) I used html to make label's text clickable, but links became ...

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...

How to embed a Python interpreter in a PyQT widget

I want to be able to bring up an interactive python terminal from my python application. Some, but not all, variables in my program needs to be exposed to the interpreter. Currently I use a sub-classed and modified QPlainTextEdit and route all "commands" there to eval or exec, and keep track of a separate namespace in a dict. However th...

Is it possible to deselect in a QTreeView by clicking off an item?

I'd like to be able to deselect items in my QTreeView by clicking in a part of the QTreeView with no items in, but I can't seem to find anyway of doing this. I'd intercept a click that's not on an item, but the QTreeView doesn't have a clicked signal, so I can't work out how to do this. ...

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...

Any really modern, good-looking desktop apps that are developed with PyQt/PySide?

Hi, I have started using Python for web development recently, it's kinda cool; I have seen programs that are developed in QT/C++, which is good enough in terms of esthetics; I have just noticed the new PySide project (which brings LGPL Qt license to Python and it doesn't support Windows yet). In view of the above, I see the possibility...

How can i know the QTreeView is empty??

Hello all. I'm using QTreeView with QDirModel to list the contents of a directory.. When a user selects an item(or a row) i'm removing it from the tree view using the below method setRowHidden (self, int, QModelIndex, bool) How can i know that the tree view is empty or all rows are hidden?? Rowcount and Columncount doesn't seem ...

Calling activateWindow on QDialog sends window to background

I am debugging certain application written with C++/Qt4. On Linux it has problems that with certain window managers (gnome-wm/metacity), the main window (based on QDialog) is created in the background (it's not raised). I managed to re-create the scenario using PyQt4 and following code: from PyQt4.QtCore import * from PyQt4.QtGui import...

PyQt: Get the position of QGraphicsWidgets in a QGraphicsGridLayout

I have a fairly simple PyQt application in which I'm placing instances of a QGraphicsWidget in a QGraphicsGridLayout and want to connect the widgets with lines drawn with a QGraphicsPath. Unfortunately, no matter what I try, I always get (0, 0) back as the position for both the start and end widgets. I'm constructing the graph with a re...

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...

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) ...