Advertisement
Klokova_Sofi

try

Dec 8th, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. from PyQt5.QtWidgets import QApplication, QWidget, QToolButton
  6. from PyQt5.QtGui import QIcon
  7.  
  8.  
  9. class Example(QWidget):
  10.  
  11. def __init__(self):
  12. super().__init__()
  13. self.initUI()
  14.  
  15. def initUI(self):
  16. self.setGeometry(300, 300, 300, 220)
  17. self.show()
  18.  
  19.  
  20. class PlusButton(QToolButton):
  21.  
  22. def __init__(self):
  23. super().__init__()
  24. self.initUI()
  25.  
  26. def initUI(self):
  27. self.icon = QIcon("plus.png"),
  28. self.popupMode = QtWidgets.QToolButton.InstantPopup
  29. self.menu()
  30. menu = QtWidgets.QMenu(button)
  31. menu.addAction(QtGui.QIcon("insert.png"), "Insert multiple rows")
  32. menu.addSeparator()
  33. menu.addAction("Place new rows above selected row")
  34. menu.addAction("Place new rows bellow selected row")
  35. menu.addAction("Place new rows at the end of the data view")
  36. button.setMenu(menu)
  37.  
  38. if __name__ == '__main__':
  39. app = QApplication(sys.argv)
  40. ex = Example()
  41. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement