class TestWin(QtGui.QWidget): def __init__(self, parent=None): super(TestWin, self).__init__(parent) self.init_ui() def init_ui(self): lyt = QtGui.QVBoxLayout() btn = QtGui.QPushButton('test button') lbl = QtGui.QLabel() icon_path = '/Desktop/people.png' lbl.setPixmap(icon_path) lyt.addWidget(btn) lyt.addWidget(lbl) self.setLayout(lyt) # Signals btn.clicked.connect(self.btn_click) lbl.mousePressEvent = self.lbl_click def btn_click(self): print 'I am clicking on the button...' def lbl_click(self, event): print 'I am clicking on the label...'
my_win = TestWin()my_win.show()
class TestWin(QtGui.QWidget): def __init__(self, parent=None): super(TestWin, self).__init__(parent) self.init_ui() def init_ui(self): ... ... # Signals btn.clicked.connect(self.btn_click) lbl.installEventFilter(self) def btn_click(self): ... def eventFilter(self, source, event): if event.type() == QtCore.QEvent.MouseButtonPress: print "The sender is:", source.text() # Returns me blank return super(TestWin, self).eventFilter(source, event)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4913a8b5-eb22-4ffd-a3d2-268dc029ab8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/985acba2-be81-422b-bd51-b84e149f530f%40googlegroups.com.
def filled_round_rect(): ... ... painter.fillPath(rounded_rect, colour)
# I added the following line self.pixmapItem = QtGui.QGraphicsPixmapItem(self.type_icon())
if self.ICON: top_right = self.boundingRect().topRight() painter.drawPixmap( top_right.x() - 35, top_right.y() + 5, self.pixmapItem # I replace this with self.type_icon() )
# TypeError: # 'PySide2.QtGui.QPainter.drawPixmap' called with wrong argument types:# PySide2.QtGui.QPainter.drawPixmap(float, float, PySide2.QtWidgets.QGraphicsPixmapItem)# Supported signatures:# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QPoint, PySide2.QtGui.QPixmap)# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QPoint, PySide2.QtGui.QPixmap, PySide2.QtCore.QRect)# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QPointF, PySide2.QtGui.QPixmap)# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QPointF, PySide2.QtGui.QPixmap, PySide2.QtCore.QRectF)# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QRect, PySide2.QtGui.QPixmap)# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QRect, PySide2.QtGui.QPixmap, PySide2.QtCore.QRect)# PySide2.QtGui.QPainter.drawPixmap(PySide2.QtCore.QRectF, PySide2.QtGui.QPixmap, PySide2.QtCore.QRectF)# PySide2.QtGui.QPainter.drawPixmap(int, int, PySide2.QtGui.QPixmap)# PySide2.QtGui.QPainter.drawPixmap(int, int, PySide2.QtGui.QPixmap, int, int, int, int)# PySide2.QtGui.QPainter.drawPixmap(int, int, int, int, PySide2.QtGui.QPixmap)# PySide2.QtGui.QPainter.drawPixmap(int, int, int, int, PySide2.QtGui.QPixmap, int, int, int, int)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7d37d380-c1ae-447c-a47d-aacd19976bc0%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4c748042-a398-44b1-97ec-845a3aea9d0e%40googlegroups.com.