コード例 #1
0
    def setupUI(self, MainWindow):
        MainWindow.setGeometry(50, 50, 800, 600)
        MainWindow.setFixedSize(800, 600)
        MainWindow.setWindowTitle("Smart Nutrition Box")

        self.widget = QWidget(MainWindow)
        self.mainLayout = QVBoxLayout()

        self.title = Title()
        self.mainLayout.addWidget(self.title)
        self.text1 = addLabel(
            "Upload Gambar Makanan Setelah Dimakan!\nContoh:", 18)
        self.mainLayout.addWidget(self.text1)

        self.labelImage = QLabel(self.widget)
        pixmap = QPixmap("tes1sisa.jpg")
        pixmap = pixmap.scaled(350, 350, Qt.KeepAspectRatio)
        self.labelImage.setPixmap(pixmap)
        self.mainLayout.addWidget(self.labelImage, alignment=Qt.AlignCenter)

        self.Button = QPushButton('Upload')
        self.Button.setFont(QFont('SansSerif', 20))
        self.Button.setFixedWidth(300)
        self.Button.clicked.connect(self.getImage)
        self.mainLayout.addWidget(self.Button, alignment=Qt.AlignCenter)

        BottomLayout(self)
        self.nextButton.setEnabled(False)
        self.mainLayout.addLayout(self.bottomLayout)

        self.widget.setLayout(self.mainLayout)
        MainWindow.setCentralWidget(self.widget)
コード例 #2
0
    def setupUI(self, MainWindow):
        MainWindow.setGeometry(50, 50, 800, 600)
        MainWindow.setFixedSize(800, 600)
        MainWindow.setWindowTitle("Smart Nutrition Box")

        self.widget = QWidget(MainWindow)
        mainLayout = QVBoxLayout()

        self.title = Title()
        mainLayout.addWidget(self.title)

        self.groupBox = QGroupBox("Jenis Makanan: " + self.jenis +
                                  "; Berat Sisa: " + self.berat + " gram")
        self.groupBox.setFont(QFont('SansSerif', 18))
        self.groupBox.setAlignment(Qt.AlignHCenter)
        gridLayout = QGridLayout()
        # Baris A
        self.text1 = addLabel("Kalori", 18)
        gridLayout.addWidget(self.text1, 0, 0)
        self.lineedit1 = addLineEdit(18, 150)
        gridLayout.addWidget(self.lineedit1, 0, 1)
        self.text1 = addLabel("kkal", 18)
        gridLayout.addWidget(self.text1, 0, 2)
        # Baris B
        self.text2 = addLabel("Karbohidrat", 18)
        gridLayout.addWidget(self.text2, 1, 0)
        self.lineedit2 = addLineEdit(18, 150)
        gridLayout.addWidget(self.lineedit2, 1, 1)
        self.text2 = addLabel("gram", 18)
        gridLayout.addWidget(self.text2, 1, 2)
        # Baris C
        self.text3 = addLabel("Protein", 18)
        gridLayout.addWidget(self.text3, 2, 0)
        self.lineedit3 = addLineEdit(18, 150)
        gridLayout.addWidget(self.lineedit3, 2, 1)
        self.text3 = addLabel("gram", 18)
        gridLayout.addWidget(self.text3, 2, 2)
        # Baris D
        self.text4 = addLabel("Lemak", 18)
        gridLayout.addWidget(self.text4, 3, 0)
        self.lineedit4 = addLineEdit(18, 150)
        gridLayout.addWidget(self.lineedit4, 3, 1)
        self.text4 = addLabel("gram", 18)
        gridLayout.addWidget(self.text4, 3, 2)

        self.groupBox.setLayout(gridLayout)
        mainLayout.addWidget(self.groupBox)

        BottomLayout(self)
        mainLayout.addLayout(self.bottomLayout)

        self.widget.setLayout(mainLayout)
        MainWindow.setCentralWidget(self.widget)
コード例 #3
0
    def setupUI(self, MainWindow):
        MainWindow.setGeometry(50, 50, 800, 600)
        MainWindow.setFixedSize(800, 600)
        MainWindow.setWindowTitle("Smart Nutrition Box")
        
        self.widget = QWidget(MainWindow)
        mainLayout = QVBoxLayout()

        self.title = Title()
        mainLayout.addWidget(self.title)
        
        self.groupBox = QGroupBox("Masukkan Berat Sisa untuk Setiap Jenis Makanan")
        self.groupBox.setFont(QFont('SansSerif', 18))
        gridLayout = QGridLayout()
        # Baris Pertama
        self.text0 = addLabel("Jenis Makanan", 18)
        gridLayout.addWidget(self.text0, 0,0)
        self.text0 = addLabel("Berat Awal", 18)
        gridLayout.addWidget(self.text0, 0,1)
        self.text0 = addLabel("Berat Sisa", 18)
        gridLayout.addWidget(self.text0, 0,3)
        # Baris A
        self.text1 = addLabel("A", 18)
        gridLayout.addWidget(self.text1, 1,0)
        self.lineedit1_bef = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit1_bef, 1,1)
        self.text1gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text1gr, 1,2)
        self.lineedit1_aft = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit1_aft, 1,3)
        self.text1gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text1gr, 1,4)
        # Baris B
        self.text2 = addLabel("B", 18)
        gridLayout.addWidget(self.text2, 2,0)
        self.lineedit2_bef = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit2_bef, 2,1)
        self.text2gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text2gr, 2,2)
        self.lineedit2_aft = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit2_aft, 2,3)
        self.text2gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text2gr, 2,4)
        # Baris C
        self.text3 = addLabel("C", 18)
        gridLayout.addWidget(self.text3, 3,0)
        self.lineedit3_bef = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit3_bef, 3,1)
        self.text3gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text3gr, 3,2)
        self.lineedit3_aft = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit3_aft, 3,3)
        self.text3gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text3gr, 3,4)
        # Baris D
        self.text4 = addLabel("A", 18)
        gridLayout.addWidget(self.text4, 4,0)
        self.lineedit4_bef = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit4_bef, 4,1)
        self.text4gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text4gr, 4,2)
        self.lineedit4_aft = addLineEdit(18, 100)
        gridLayout.addWidget(self.lineedit4_aft, 4,3)
        self.text4gr = addLabel("gram", 18)
        gridLayout.addWidget(self.text4gr, 4,4)

        self.groupBox.setLayout(gridLayout)
        mainLayout.addWidget(self.groupBox)

        BottomLayout(self)
        self.nextButton.setEnabled(False)
        mainLayout.addLayout(self.bottomLayout)

        self.lineedit1_bef.textChanged.connect(self.enableNextButton)
        self.lineedit2_bef.textChanged.connect(self.enableNextButton)
        self.lineedit3_bef.textChanged.connect(self.enableNextButton)
        self.lineedit4_bef.textChanged.connect(self.enableNextButton)
        self.lineedit1_aft.textChanged.connect(self.enableNextButton)
        self.lineedit2_aft.textChanged.connect(self.enableNextButton)
        self.lineedit3_aft.textChanged.connect(self.enableNextButton)
        self.lineedit4_aft.textChanged.connect(self.enableNextButton)

        self.widget.setLayout(mainLayout)
        MainWindow.setCentralWidget(self.widget)
コード例 #4
0
    def setupUI(self, MainWindow):
        MainWindow.setGeometry(50, 50, 800, 600)
        MainWindow.setFixedSize(800, 600)
        MainWindow.setWindowTitle("Smart Nutrition Box")

        self.widget = QWidget(MainWindow)
        mainLayout = QVBoxLayout()

        self.title = Title()
        mainLayout.addWidget(self.title)

        self.groupBox = QGroupBox("Prediksi Berat Sisa Makanan")
        self.groupBox.setFont(QFont('SansSerif', 18))
        self.groupBox.setAlignment(Qt.AlignHCenter)
        gridLayout = QGridLayout()
        self.text0a = addLabel("Berat Asli (gr)", 15)
        self.text0b = addLabel("Berat Prediksi (gr)", 15)
        self.text0c = addLabel("Berat Error (%)", 15)
        gridLayout.addWidget(self.text0a, 0, 1)
        gridLayout.addWidget(self.text0b, 0, 2)
        gridLayout.addWidget(self.text0c, 0, 3)
        # Baris A
        self.text1 = addLabel("A", 18)
        gridLayout.addWidget(self.text1, 1, 0)
        self.lineedit1a = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit1a, 1, 1)
        self.lineedit1b = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit1b, 1, 2)
        self.lineedit1c = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit1c, 1, 3)
        # Baris B
        self.text2 = addLabel("B", 18)
        gridLayout.addWidget(self.text2, 2, 0)
        self.lineedit2a = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit2a, 2, 1)
        self.lineedit2b = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit2b, 2, 2)
        self.lineedit2c = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit2c, 2, 3)
        # Baris C
        self.text3 = addLabel("C", 18)
        gridLayout.addWidget(self.text3, 3, 0)
        self.lineedit3a = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit3a, 3, 1)
        self.lineedit3b = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit3b, 3, 2)
        self.lineedit3c = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit3c, 3, 3)
        # Baris D
        self.text4 = addLabel("D", 18)
        gridLayout.addWidget(self.text4, 4, 0)
        self.lineedit4a = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit4a, 4, 1)
        self.lineedit4b = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit4b, 4, 2)
        self.lineedit4c = addLineEdit(18, 180)
        gridLayout.addWidget(self.lineedit4c, 4, 3)

        self.groupBox.setLayout(gridLayout)
        mainLayout.addWidget(self.groupBox)

        BottomLayout(self)
        mainLayout.addLayout(self.bottomLayout)

        self.widget.setLayout(mainLayout)
        MainWindow.setCentralWidget(self.widget)