pyside

How do I create a critical error message using PySide?

十年热恋 提交于 2019-12-01 08:20:46
问题 I seem to be hitting a brick wall. No matter what I do, creating a critical error Message Box just doesn't seem to be working. Here's what I've tried thus far: flags = QtGui.QMessageBox.StandardButton.Abort flags |= QtGui.QMessageBox.StandardButton.Ignore result = QtGui.QMessageBox.critical( self, 'CRITICAL ERROR', 'Error Message', flags ) As taken from this tutorial (old I know, but it's been helpful thus far). Doing this however, brings up the following error: 'PySide.QtGui.QMessageBox

QtDesigner & PySide: QTableWidget don't get accessible

人盡茶涼 提交于 2019-12-01 07:34:20
I made a form in QtDesigner. This form gets loaded from PySide with help of the function widget = loader.load(file, parent) However, the QTableWidget (with objectNname buffer_table) don't get accessible with widget.buffer_table If I use a QPushButton instead it works. How can I get this working. I'd like to fill up the table in Python. This is the ui-file i'd like to use: http://pastebin.com/6PZFrvmr EDIT: When I create a new table and try to load it, it seems to work. However, if I put it in a QTabWidget I can't access it. EDIT2: widget.findChild(QWidget, "buffer_table") : Search & find is

How to connect custom signal to slot in pyside with the new syntax?

限于喜欢 提交于 2019-12-01 07:26:28
问题 This is an example from an video tutorial: #!/usr/bin/env python3 import sys from PySide.QtCore import * from PySide.QtGui import * class ZeroSpinBox(QSpinBox): zeros = 0 def __init__(self): super().__init__() self.valueChanged.connect(self.checkzero) def checkzero(self): if self.value() == 0: self.zeros += 1 self.emit(SIGNAL("atzero(int)"), self.zeros) class Form(QDialog): def __init__(self): super().__init__() dial = QDial() dial.setNotchesVisible(True) zerospinbox = ZeroSpinBox() layout =

PySide: Separating a spritesheet / Separating an image into contiguous regions of color

可紊 提交于 2019-12-01 06:50:27
问题 I'm working on a program in which I need to separate spritesheets , or in other words, separate an image into contiguous regions of color. I've never done any image processing before, so I'm wondering how I would go about this. What would I do after I test for pixel color? What's the best way to determine which pixel goes with each sprite? All the input images have uniform backgrounds, and an alpha channel different from that of the background counts as color. The order of the output images

Python: How to rebase or dynamically replace a class with a different base class

十年热恋 提交于 2019-12-01 06:46:39
I am trying to create a common class which I want to use inside different applications. The idea: a class which could be used as a base class for ui creations. This class will be based to a widget of the applications in it's specific gui system (PySide, or PyQt) This would allow me to follow the same code flow to generate gui's. I like to have same structures inside my pipeline and it makes it much easier to work in different applications with the same commands. The problem: PyQt and PySide are compiled in C++ and do not follow the Python class structure I tried a lot of different things to

Calling custom class in .ui file fails

前提是你 提交于 2019-12-01 06:40:51
问题 I get this error when I try to refer to my custom class from .ui file. What's wrong with what I do? "QFormBuilder was unable to create a custom widget of the class 'TimelinePane'; defaulting to base class 'QWidget'." QWidget pops up with the layout I'm specifying in .ui file. Problem is just the custom class. To add the custom class' description, I modified .ui file manually (added the entire <customwidgets> section), which is why I have to open a new question since I haven't found the same Q

How to add multiple QPushButtons to a QTableView?

坚强是说给别人听的谎言 提交于 2019-12-01 06:39:25
I have a QTableView to which I want to set a QPushButton for every row. I am doing this as follows within my class derived from QWidget following an example found here : for index in range(number_rows): btn_sell = QPushButton("Edit", self) btn_sell.clicked.connect(self.button_edit) table_view.setIndexWidget(table_view.model().index(index, 4), btn_sell) If the table is drawn and I click on one of the QPushButton the method self.button_edit is called - but which one? It does not seem that an 'event' of any sort is given to self.button_edit , so how can I find the row-index of the QPushButton

How can I intercept when a widget loses its focus

我的梦境 提交于 2019-12-01 05:32:37
问题 I have a QPlainTextEdit and want to process the content when it loses focus. I've seen that I can either do this with the focusChanged event or with the focusOutEvent virtual function. I don't know how to pass parameters with the new syntax (i.e. my_app.focusChanged.connect(my_handler) where my_handler is a locally defined function). So I tried working with the virtual function. Since the interface is created with QT Designer inheriting QPlainTextEdit would be an overkill, so I tried to

Python: How to rebase or dynamically replace a class with a different base class

邮差的信 提交于 2019-12-01 05:04:30
问题 I am trying to create a common class which I want to use inside different applications. The idea: a class which could be used as a base class for ui creations. This class will be based to a widget of the applications in it's specific gui system (PySide, or PyQt) This would allow me to follow the same code flow to generate gui's. I like to have same structures inside my pipeline and it makes it much easier to work in different applications with the same commands. The problem: PyQt and PySide

MousePressEvent, position offset in QGraphicsView

核能气质少年 提交于 2019-12-01 04:52:49
I've some difficulties with QGraphicsView and QGraphicsScene . When I zoom/unzoom in the scene and create items with mousePressEvent, I have an offset in the position. How can this be avoided? event.pos() seems to be the problem.. from PyQt4 import QtCore, QtGui class graphicsItem (QtGui.QGraphicsItem): def __init__ (self): super(graphicsItem, self).__init__() self.rectF = QtCore.QRectF(0,0,10,10) def boundingRect (self): return self.rectF def paint (self, painter=None, style=None, widget=None): painter.fillRect(self.rectF, QtCore.Qt.red) class graphicsScene (QtGui.QGraphicsScene): def __init_