From 8c20fc2c5fb2febeb28b7526ea0ba92c8413cd34 Mon Sep 17 00:00:00 2001 From: Felix Goding <felgo673@student.liu.se> Date: Tue, 7 Apr 2020 18:08:59 +0200 Subject: [PATCH] Add text boxes to get input from user for name/id --- b_asic/GUI/start_window.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/b_asic/GUI/start_window.py b/b_asic/GUI/start_window.py index b9b21a31..1105437a 100644 --- a/b_asic/GUI/start_window.py +++ b/b_asic/GUI/start_window.py @@ -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() -- GitLab