pyqt

PyQt4 Move QTableWidget row with widgets

I have the following method in my PyQt4 app. r2 is the number of row to move, and r1 is the position where it should be moved. To clarify: the table is filled with cellWidgets, not widgetItems. def move_row(self, r1, r2): tt = self.tableWidget tt.insertRow(r1) for c in range(tt.columnCount()): tt.setCellWidget(r1, c,...

Qt -> PyQT problem with drawCheck()

Hi, I have QTableView with checkbox, but the checkbox is aligned left I need to align it center I try this: http://qt.nokia.com/developer/faqs/faq.2008-01-03.2614755816 But have problem with check function def drawCheck(self, painter, option, rect, state): textMargin = QtGui.QApplication.style().pixelMetric(QtGui.QStyle.PM_FocusF...

PyQt4.QtCore.pyqtSignal object has no attribute 'connect'

I'm having issues with a custom signal in a class I made. Relevant code: self.parse_triggered = QtCore.pyqtSignal() def parseFile(self): self.emit(self.parse_triggered) Both of those belong to the class: RefreshWidget. In its parent class I have: self.refreshWidget.parse_triggered.connect(self.tabWidget.giveTabsData()) When I...

PyQt blocking version of show()

I've got a fairly cpu-intensive application, but all of the cpu-intensive stuff is started by clicking a QPushButton. When the button is clicked, a hidden QLabel is show()n. Apparently, show() is non-blocking. Unfortunately, this means that the cpu-intensive stuff is practically half-done before the label show()s up. How can I make s...

How to use custom drawing in QGraphicsViews in PyQt?

I need to view QGraphicsScene in 2 QGraphicsViews with condition that they have different scale factors for items in scene. Closest function which I found is drawItems(), but as far I can understand, it must be called manually. How to repaint views automatically? I have these two code fragments in program: class TGraphicsView(QGraphicsV...

PyQT: get recursive children of a widget

Anyone have a slick function that will return a nested tree of all the children of a particular widget? I'm familiar with dumpObjectTree() but I'm not able to compile in debug mode, so I don't have access to that function. Trying to find a particular widget and I'm traversing the children() hierarchy by hand. There's got to be a bette...

how to create a theme with QT

hello im looking for a way to make my pyqt interface look nicer by adding a theme to it. im new to Qt and i still have no idea how to add a custom theme for widgets.. so how is that possible ? and is it possible through qt designer ? sorry for my bad english , its my third language. i hope the idea is clear enough . please let me kn...

how to set a pop up menu on a particular table view item

hello i have a QTableView , and i need to show a popup menu that shows the item properties . i need to set the context menu to apear only when you right click over a particular items in that tableview. but coudln't find a way to do it . i can set the context menu to appear when your over the table . i cant have it for each item . so ho...

what is the recommended way of running a embedded web server within a desktop app (say wsgi server with pyqt)

The desktop app should start the web server on launch and should shut it down on close. Assuming that the desktop is the only client allowed to connect to the web server, what is the best way to write this? Both the web server and the desktop run in a blocking loop of their own. So, should I be using threads or multiprocessing? ...

How to get all attributes for a particular xml node in qt

hello is it possible to get all attributes for a particular node in pyqt ? for example .. consider for following node: < asset Name="3dAsset" ID="5"/> i want to retrieve the ("Name" and "ID") strings is it possible? thanks in advance ...

Set global position for a QLabel

Hi I'm trying to display a QLabel (without parent) at a fixed position using PyQt. The QLabel functions as a graphic that appears only for a moment, it's appears in the middle of the screen by default but I can't find how to move its position. Any suggestion?? updated: This is my code, maybe is a problem in the way I'm doing this: ...

Execute a PyQt app from an acpi event in linux

Hi, I want to use a PyQt application to display an image when some acpi event is triggered under linux. I already setting up the configuration for the event and the python scrip is executed when the event is triggered, but when program reach the creation of the QApplication app = QApplication(sys.argv) it stops without error. I tri...

Bug when drawing a QImage on a widget with PIL and PyQt

I'm trying to write a small graphic application, and I need to construct some image using PIL that I show in a widget. The image is correctly constructed (I can check with im.show()), I can convert it to a QImage, that I can save normally to disk (using QImage.save), but if I try to draw it directly on my QWidget, it only show a white sq...

Qt/PyQt dialog with togglable fullscreen mode - problem on Windows

I have a dialog created in PyQt. It's purpose and functionality don't matter. The init is: class MyDialog(QWidget, ui_module.Ui_Dialog): def __init__(self, parent=None): super(MyDialog, self).__init__(parent) self.setupUi(self) self.installEventFilter(self) self.setWindowFlags(Qt.Dialog | Qt....

How do I export GUI mockups to Python GUI code (e.g. wxpython)?

I want to take my mockups and export them to code using any python GUI library (wxpython, pyqt, etc). For example, this capability already exists for mockups->HTML/Javascript here: http://www.balsamiq.com/products/mockups/community I need a fast, easy, high level mockup tool like balsamiq, not a slow, low level tool like boa constructo...

Loading page with frames for a screenshot

I have an app that renders a web page in a iframe, and then loads X number of images in a div that overlays the frame. So I have this python script that loads the url, and takes a screenshot. It works on regular web pages, but I think the frame is throwing it off. Below is my code, and a link to the screenshot it's taking. #!/usr/bin/...

Multi-dialog program in PyQT will not close

For my project, I require multiple dialogs to be linked to each other. One button would go to one level, another button would go back two levels. To get a basic idea of what I'm looking for without showing all my code, here is a compilable example: ''' Created on 2010-06-18 @author: dhatt ''' import sys from PyQt4 import QtGui, QtCo...

Multi-dialog program in PyQT will not close (the sequel!)

Hello everyone. I have another problem with PyQT, this time I have an example that will be far more useful since it contains part of my code (defanged of course!) I have a hard time figuring out how to close the 'PROGRAM SELECT' dialog window by only using the 'LOGOUT' button. I could simply use the close button on the form, but I wan...

printing unicode through a QProcess

I'm having some trouble handling unicode output from a QProcess. When I run the following example I get ?? instead of 中文. Can anyone tell me how to get the unicode output? from PyQt4.QtCore import * def on_ready_stdout(): byte_array = proc.readAllStandardOutput() print 'byte_array: ', byte_array print 'unicode: ', unicode...

Get a layout's widgets in PyQT

I have a QVBoxLayout that I've added a few widgets to, via addWidget(). I need to now delete those widgets, and it seems I need to use removeWidget() (which takes in a widget to be removed) to do that. I thought that calling children() or findChildren(QWidget) on my layout would return a list of the widgets I've added into it; I'm in t...