Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PySide import QtCore, QtGui
- class TestWidget(QtGui.QWidget):
- """
- A simple Pie menu class. Use in a similar way to QMenu: Create a PieMenu and add QActions to it with QAction.
- """
- def __init__(self, parent=None):
- super(TestWidget, self).__init__(parent)
- # with this flag set the application does not quit properly, without it does
- self.setWindowFlags(QtCore.Qt.Popup)
- def mousePressEvent(self, e):
- self.close()
- def keyPressEvent(self, event):
- if event.key() == QtCore.Qt.Key_Escape:
- self.close()
- if __name__ == '__main__':
- import sys
- app = QtGui.QApplication(sys.argv)
- w = TestWidget()
- w.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment