Skip to content
Snippets Groups Projects

Implemented a GUI framework

Merged Felix Goding requested to merge 44-create-basic-gui into develop
All threads resolved!
1 file
+ 23
9
Compare changes
  • Side-by-side
  • Inline
+ 23
9
@@ -42,9 +42,6 @@ class DragButton(QPushButton):
super(DragButton, self).mouseReleaseEvent(event)
def clicked():
print ("Drag button clicked")
class subwindow(QWidget):
def createWindow(self,WindowWidth,WindowHeight):
parent=None
@@ -98,7 +95,7 @@ class MainWindow(QMainWindow):
addition_button = DragButton("Addition", self)
addition_button.move(10, 130)
addition_button.setFixedSize(70, 20)
addition_button.clicked.connect(clicked)
addition_button.clicked.connect(self.clicked)
addition_counter = 1
subtraction_button = DragButton("Subtraction", self)
@@ -124,6 +121,9 @@ class MainWindow(QMainWindow):
def exit_app(self, checked):
QApplication.quit()
def clicked(self):
print ("Drag button clicked")
def paintEvent(self, e):
painter = QPainter(self)
@@ -140,17 +140,31 @@ class MainWindow(QMainWindow):
self.sub_window.properties_label.setFont(QFont('SansSerif', 14, QFont.Bold))
self.sub_window.properties_label.setAlignment(Qt.AlignCenter)
name_label = QLabel(self.sub_window)
name_label.setText('Name:')
self.sub_window.name_label = QLabel(self.sub_window)
self.sub_window.name_label.setText('Name:')
self.sub_window.name_label.move(20, 40)
self.sub_window.name_line = QLineEdit(self.sub_window)
self.sub_window.name_line.setPlaceholderText("Write a name here")
self.sub_window.name_line.move(70, 40)
self.sub_window.name_line.resize(100, 20)
self.sub_window.id_label = QLabel(self.sub_window)
self.sub_window.id_label.setText('Id:')
self.sub_window.id_label.move(20, 70)
id_label = QLabel(self.sub_window)
id_label.setText('Id:')
self.sub_window.id_line = QLineEdit(self.sub_window)
self.sub_window.id_line.setPlaceholderText("Write an id here")
self.sub_window.id_line.move(70, 70)
self.sub_window.id_line.resize(100, 20)
"""
vertical_box = QVBoxLayout()
vertical_box.addWidget(name_label)
vertical_box.addWidget(self.sub_window.name_label)
vertical_box.addWidget(id_label)
self.sub_window.setLayout(vertical_box)
"""
self.sub_window.show()
Loading