pyside

simple IPython example raises exception on sys.exit()

倖福魔咒の 提交于 2019-11-27 14:25:34
I'm doing some very simple PySide (and PyQt) tutorials in IPython. One tutorial just creates a window with some sliders to demonstrate slots and signals. When I close the window of the running demo application, I see this error: An exception has occurred, use %tb to see the full traceback. SystemExit: 0 To exit: use 'exit', 'quit', or Ctrl-D. So I run %tb and get this: SystemExit Traceback (most recent call last) /Workspaces/scratch/<ipython-input-1-88966dcfb499> in <module>() 33 34 if __name__ == "__main__": ---> 35 main() /Workspaces/scratch/<ipython-input-1-88966dcfb499> in main() 29 w.show

What are the mechanics of the default delegate for item views in Qt?

眉间皱痕 提交于 2019-11-27 14:22:05
问题 Short version What is the default delegate used by QTreeView ? In particular I am trying to find its paint() method? Longer version I am a Python user (Pyside/PyQt), and am using a custom delegate to recreate some of the functionality of QTreeView . Hence, I am trying to find the default delegate, and paint method, that is used in a QTreeView . Even better would be an explanation of how it works. Cross post I posted the same question at Qt Centre (http://www.qtcentre.org/threads/64458-Finding

Python PySide and Progress Bar Threading

五迷三道 提交于 2019-11-27 11:36:42
I have this code: from PySide import QtCore, QtGui import time class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(400, 133) self.progressBar = QtGui.QProgressBar(Dialog) self.progressBar.setGeometry(QtCore.QRect(20, 10, 361, 23)) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(20, 40, 361, 61)) self.pushButton.setObjectName("pushButton") self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def

How do you load .ui files onto python classes with PySide?

别说谁变了你拦得住时间么 提交于 2019-11-27 10:56:12
问题 I've used PyQt for quite a while, and the entire time I've used it, there has been a pretty consistent programming pattern. Use Qt Designer to create a .ui file. Create a python class of the same type as the widget you created in the .ui file. When initializing the python class, use uic to dynamically load the .ui file onto the class. Is there any way to do something similar in PySide? I've read through the documentation and examples and the closest thing I could find was a calculator example

Is the PySide Slot Decorator Necessary?

天涯浪子 提交于 2019-11-27 10:17:22
问题 I've seen some example code for PySide slots that uses the @QtCore.Slot decorator, and some that does not. Testing it myself, it doesn't seem to make a difference. Is there a reason I should or should not use it? For example, in the following code: import sys from PySide import QtCore # the next line seems to make no difference @QtCore.Slot() def a_slot(s): print s class SomeClass(QtCore.QObject): happened = QtCore.Signal(str) def __init__(self): QtCore.QObject.__init__(self) def do_signal

How to get text from a QLineEdit dynamically? [closed]

廉价感情. 提交于 2019-11-27 08:53:27
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . How could get String(Text) from QlineEdit ? I tried Like this. myArea.getList() function is get string value and check database with string value and return List self.a = QLineEdit() self.b = QlineEdit() .... self.b = self.myArea.getList(str(self.a.textChanged.connect(self.textchanged))) def

How to distinguish between mouseReleaseEvent and mousedoubleClickEvent on QGraphicsScene

江枫思渺然 提交于 2019-11-27 08:44:42
问题 I am overriden QGraphicsScene and overload 2 methods: mouseDoubleClickEvent and mouseReleaseEvent . I want different logic executing on each of this event, but I do not know how to distinguish it? At least 1 mouseReleaseEvent occured before mouseDoubleClickEvent . 回答1: For the logic that you want to occur on a double click, put the code inside mouseDoubleClickEvent() and for the logic that you want to occur on a mouse release, put the code inside mouseReleaseEvent() . If you want to do

Python code generation with pyside-uic

南楼画角 提交于 2019-11-27 08:19:58
How can I generate python code from a QtDesigner file ? I found pyside-uic but I can't find an example for the syntax. I run win7 and pythonxy with spyder. pyside-uic is more or less identical to pyuic4, as such the man page specifies: Usage: pyside-uic [options] <ui-file> Options: --version show program's version number and exit -h,--help show this help message and exit -oFILE,--output=FILE write generated code to FILE instead of stdout -x,--execute generate extra code to test and display the class -d,--debug show debug output -iN,--ident=N set indent width to N spaces, tab if N is 0 (default

How to change text alignment in QTabWidget?

落花浮王杯 提交于 2019-11-27 08:09:17
I cannot find a way to set the text alignment in a QTabWidget. After I've created an instance of this widget, I've set its tabPosition property to West, but I wish it showed text/label horizontally. I've given a look to the Qt's stylesheets , but as you can see, the text-align property can only be set on QPushButton and QProgressBar. I already searched on the web, but I just found a bugreport , a non-answered question , and finally a user that suggests to re-implement the paint() method. Maybe I'd solve, but I'm using Python (PyQt or PySide) and I don't know how to do it. Can you help me? EDIT

How to know if object gets deleted in Python

余生颓废 提交于 2019-11-27 07:57:01
问题 I have an object in the heap and a reference to it. There are certain circumstances in which the object gets deleted but the reference that points to its location doesn't know that. How can I check if there is real data in the heap? For example: from PySide import * a = QProgressBar() b = QProgressBar() self.setIndexWidget(index,a) self.setIndexWidget(index,b) Then the a object gets deleted but print(a) returns a valid address. However if you try a.value() - runtime error occurs (C++ object