Advertisement
Guest User

Untitled

a guest
Oct 24th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. from PyQt5.QtWidgets import QWidget, QLabel, QLineEdit, QDoubleSpinBox, QComboBox, QRadioButton, QPushButton, QHBoxLayout, QVBoxLayout, QTextEdit, QGridLayout
  2.  
  3. class AlbumDatabase (QWidget):
  4. def __init__(self, parent=None):
  5. super().__init__(parent)
  6. self.createWidgets()
  7. self.arrangeWidgets()
  8. self.setWindowTitle ("Album Database")
  9. #self.setMinimumSize (320,200)
  10. #self.setMaximumSize (700,500)
  11.  
  12.  
  13. def createWidgets(self):
  14.  
  15. self.albumtitleLabel = QLabel("Album Title: ")
  16. self.albumtitleLineEdit = QLineEdit()
  17. self.albumtitleLineEdit.setMaximumSize(300,20)
  18. self.albumtitleLabel.setBuddy(self.albumtitleLineEdit)
  19.  
  20. self.artistLabel = QLabel("Artist: ")
  21. self.artistLineEdit = QLineEdit()
  22. self.artistLineEdit.setMaximumSize(300,20)
  23. self.artistLabel.setBuddy(self.artistLineEdit)
  24.  
  25. self.yearLabel = QLabel ("year: ")
  26. self.yearDoubleSpinBox = QDoubleSpinBox()
  27. self.yearLabel.setBuddy(self.yearDoubleSpinBox)
  28. self.yearDoubleSpinBox.setRange(2005,2015);
  29. self.yearDoubleSpinBox.setSingleStep(1);
  30.  
  31. self.genreLabel = QLabel ("Genre: ")
  32. genreList = ["Rock", "House", "Classical", "Pop", "R&B"]
  33. self.genreComboBox = QComboBox()
  34. self.genreComboBox.addItems (genreList)
  35. self.genreLabel.setBuddy(self.genreComboBox)
  36.  
  37. self.formatLabel = QLabel ("Format: ")
  38. self.lpRadioButton = QRadioButton()
  39. self.lpLabel = QLabel("LP")
  40. self.cdRadioButton = QRadioButton()
  41. self.cdLabel = QLabel("CD")
  42. self.mp3RadioButton = QRadioButton()
  43. self.mp3Label = QLabel("MP3")
  44. self.flacRadiobutton = QRadioButton()
  45. self.flacLabel = QLabel("FLAC")
  46.  
  47. #self.notesLabel = QLabel("Notes: ")
  48.  
  49. #self.notesTextEdit = QTextEdit()
  50.  
  51. #self.addalbumPushButton = QPushButton("Add Album")
  52. #self.cancelPushButton = QPushButton("Cancel")
  53.  
  54.  
  55.  
  56. def arrangeWidgets (self):
  57.  
  58. #GridLayout:
  59. self.topLeftLayout = QGridLayout()
  60. self.topLeftLayout.addWidget(self.albumtitleLabel,0,0)
  61. self.topLeftLayout.addWidget(self.albumtitleLineEdit,0,1)
  62. self.topLeftLayout.addWidget(self.artistLabel,1,0)
  63. self.topLeftLayout.addWidget(self.artistLineEdit,1,1)
  64. self.topLeftLayout.addWidget(self.yearLabel,2,0)
  65. self.topLeftLayout.addWidget(self.yearDoubleSpinBox,2,1)
  66. self.topLeftLayout.addWidget(self.genreLabel,2,2)
  67. self.topLeftLayout.addWidget(self.genreComboBox,2,3)
  68.  
  69.  
  70. self.topLeftLayout.addWidget(self.formatLabel,3,0)
  71. self.topLeftLayout.addWidget(self.lpRadioButton,3,1)
  72. self.topLeftLayout.addWidget(self.lpLabel,3,2)
  73. self.topLeftLayout.setSpacing (10)
  74.  
  75.  
  76. #self.radioButtonLayout = QHBoxLayout()
  77. #self.radioButtonLayout.addWidget(self.formatLabel)
  78. #self.radioButtonLayout.addWidget(self.lpRadioButton)
  79. #self.radioButtonLayout.addWidget(self.lpLabel)
  80.  
  81.  
  82. #self.radioButtonLayout = QHBoxLayout()
  83. #self.radioButtonLayout.addWidget(self.formatLabel)
  84.  
  85.  
  86. #Creating mainLayout:
  87. self.mainLayout = QHBoxLayout()
  88. self.mainLayout.addLayout(self.topLeftLayout)
  89. #self.mainLayout.addLayout(self.radioButtonLayout)
  90. self.setLayout(self.mainLayout)
  91.  
  92.  
  93.  
  94. if __name__ == "__main__":
  95. import sys
  96. from PyQt5.QtWidgets import QApplication
  97. app = QApplication (sys.argv)
  98. window = AlbumDatabase()
  99. window.show()
  100. sys.exit (app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement