Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. import os, sys
  2.  
  3. from PyQt5.QtGui import *
  4. from PyQt5.QtWidgets import *
  5. from PyQt5.QtCore import *
  6. from PyQt5.QtPrintSupport import *
  7.  
  8.  
  9.  
  10. class Widget(QWidget):
  11.  
  12. def __init__(self, parent):
  13. super(Widget, self).__init__(parent)
  14.  
  15.  
  16.  
  17. class mainWindow(QMainWindow):
  18.  
  19.  
  20. def __init__(self, parent=None):
  21. super(mainWindow, self).__init__(parent)
  22.  
  23. self.form_widget = Widget(self)
  24. self.setCentralWidget(self.form_widget)
  25. self.setWindowIcon(QIcon('icon.png'))
  26.  
  27. self.setWindowTitle("Dialogi")
  28. self.status = QStatusBar()
  29. self.setStatusBar(self.status)
  30. self.setStyleSheet("background-color: lime;")
  31.  
  32. titles = ['Kolor okna głównego', 'Ustaw koła']
  33. functions = [self.foo, self.foo]
  34. actions = []
  35.  
  36. mainMenu = self.menuBar()
  37. fileMenu = mainMenu.addMenu('&Dialog')
  38. for i in range(0, len(titles)):
  39. a = QAction(titles[i], self)
  40. a.triggered.connect(functions[i])
  41. #a.setShortcut(shortcuts[i])
  42. actions.append(a)s
  43. fileMenu.addAction(actions[i])
  44.  
  45.  
  46. def foo(self):
  47. return 1
  48.  
  49.  
  50.  
  51. if __name__ == "__main__":
  52. app = QApplication(sys.argv)
  53. app.aboutToQuit.connect(app.deleteLater)
  54. win = mainWindow()
  55. win.show()
  56. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement