Advertisement
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.Tool)
- def mousePressEvent(self, e):
- self.close() # this closes the widget but does not quit the application
- app = QtGui.QApplication.instance()
- if True: # what logic can I use to figure out if this is a standalone app or run from a host applicatin?
- app.quit()
- 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
Advertisement