Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # -*- coding: utf-8 -*-
- import sys
- from PyQt5.QtWidgets import *
- #QApplication, QWidget, QToolButton
- from PyQt5.QtGui import QIcon
- class PlusButton(QToolButton):
- def __init__(self, QWidget):
- super().__init__()
- self.show()
- #self.initUI()
- """
- def initUI(self):
- self.icon = QIcon("C://Users/kloko/Pictures/plus.png")
- #self.setPopupMode(self, InstantPopup)
- #self.popupMode = QtWidgets.QToolButton.InstantPopup
- self.letsMakeMenu()
- self.show()
- def letsMakeMenu(self):
- menu = QMenu(self)
- menu.addAction(QIcon("C://Users/kloko/Pictures/insert.png"), "Insert multiple rows")
- menu.addSeparator()
- menu.addAction("Place new rows above selected row")
- menu.addAction("Place new rows bellow selected row")
- menu.addAction("Place new rows at the end of the data view")
- self.setMenu(menu)
- """
- class Example(QWidget):
- def __init__(self):
- super().__init__()
- #self.addButton = PlusButton()
- button = PlusButton(self)
- button.move(100, 70)
- self.initUI()
- def initUI(self):
- self.setGeometry(300, 300, 300, 220)
- self.show()
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- ex = Example()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement