Exemple #1
0
    def OnAdd(self, templat, templon):
        tempCount = self.wpList.GetItemCount()
        dlg = InputDialog(self, "Add WP", str(tempCount + 1))
        temp2 = str(templat)
        dlg.latText.SetValue(temp2)
        temp3 = str(templon)
        dlg.lonText.SetValue(temp3)

        if dlg.ShowModal() == wx.ID_OK:
            tempList = dlg.GetValue()
            index = self.wpList.InsertStringItem(sys.maxint,
                                                 str(tempCount + 1))
            for i in range(7):
                self.wpList.SetStringItem(index, i + 1, tempList[i])
            self._waypointList.append({
                'id': index + 1,
                'type': tempList[0],
                'lat': float(tempList[1]),
                'lon': float(tempList[2]),
                'alt': float(tempList[3]),
                'p1': int(tempList[4]),
                'p2': int(tempList[5]),
                'p3': int(tempList[6])
            })
            self.deh._waypointLists[2] = self._waypointList
        else:
            pass
        dlg.Destroy()
Exemple #2
0
    def OnPopupMenuAdd(self, event):
        itemId = event.GetId()
        menu = event.GetEventObject()
        menuItem = menu.FindItemById(itemId)

        tempCount = self.wpList.GetItemCount()
        dlg = InputDialog(self, "Add WP", str(tempCount + 1))
        if dlg.ShowModal() == wx.ID_OK:
            tempList = dlg.GetValue()
            index = self.wpList.InsertStringItem(sys.maxint,
                                                 str(tempCount + 1))
            for i in range(7):
                self.wpList.SetStringItem(index, i + 1, tempList[i])
            self._waypointList.append({
                'id': index + 1,
                'type': tempList[0],
                'lat': float(tempList[1]),
                'lon': float(tempList[2]),
                'alt': float(tempList[3]),
                'p1': int(tempList[4]),
                'p2': int(tempList[5]),
                'p3': int(tempList[6])
            })
            self.deh._waypointLists[2] = self._waypointList
        else:
            pass
        dlg.Destroy()
Exemple #3
0
 def btnInputScoreClicked(self):
     self.data = []
     self.setScore()
     self.dlg = InputDialog(
         self.data)  # 매개변수 self.data : dialog에 입력했던 점수를 불러오기 위한 장치
     self.dlg.exec_()
     self.dumpData()
     self.setData()
Exemple #4
0
 def btnInputScoreClicked(self):
     self.data = []
     self.setScore()
     self.dlg = InputDialog(self.data)  # 매개변수 self.data : dialog에 입력했던 점수를 불러오기 위한 장치
     self.dlg.exec_()
     self.dumpData()
     self.setData()
     if self.checkBoxNow == True:
         self.drawAllGraph()
     else:
         self.drawGraph()
def main():
    # create animation window
    win = GraphWin("Projectile Animation", 640, 480, autoflush=False)
    win.setCoords(-10, -10, 210, 155)
    Line(Point(-10, 0), Point(210, 0)).draw(win)
    for x in range(0, 210, 50):
        Text(Point(x, -5), str(x)).draw(win)
        Line(Point(x, 0), Point(x, 2)).draw(win)

    # event loop, each time through fires a single shot
    angle, vel, height = 45.0, 40.0, 2.0
    while True:
        # interact with the user
        inputwin = InputDialog(angle, vel, height)
        choice = inputwin.interact()
        inputwin.close()

        if choice == "Quit":  # loop exit
            break

        # creat a shot and track until it hits ground or leaves window
        angle, vel, height = inputwin.getValues()
        shot = ShotTracker(win, angle, vel, height)
        while 0 <= shot.getY() and -10 < shot.getX() <= 210:
            shot.update(1 / 50)
            update(50)

    win.close()
Exemple #6
0
    def OnPopupMenuEdit(self, event, item):
        itemId = event.GetId()
        menu = event.GetEventObject()
        menuItem = menu.FindItemById(itemId)
        #print menuItem.GetLabel()
        dlg = InputDialog(self, "Edit WP", str(int(item)))

        temp1 = self.wpList.GetItemText(int(item) - 1, col=1)
        dlg.type.SetValue(temp1)
        temp2 = self.wpList.GetItemText(int(item) - 1, col=2)
        dlg.latText.SetValue(temp2)
        temp3 = self.wpList.GetItemText(int(item) - 1, col=3)
        dlg.lonText.SetValue(temp3)
        temp4 = self.wpList.GetItemText(int(item) - 1, col=4)
        dlg.altText.SetValue(temp4)
        temp5 = self.wpList.GetItemText(int(item) - 1, col=5)
        dlg.p1Text.SetValue(temp5)
        temp6 = self.wpList.GetItemText(int(item) - 1, col=6)
        dlg.p2Text.SetValue(temp6)
        temp7 = self.wpList.GetItemText(int(item) - 1, col=7)
        dlg.p3Text.SetValue(temp7)

        if dlg.ShowModal() == wx.ID_OK:
            tempList = dlg.GetValue()
            index = int(item) - 1
            for i in range(7):
                self.wpList.SetStringItem(index, i + 1, tempList[i])
            self._waypointList[index] = {
                'id': index + 1,
                'type': tempList[0],
                'lat': float(tempList[1]),
                'lon': float(tempList[2]),
                'alt': float(tempList[3]),
                'p1': int(tempList[4]),
                'p2': int(tempList[5]),
                'p3': int(tempList[6])
            }
            self.deh._waypointLists[2] = self._waypointList
        dlg.Destroy()
    def iniciar(self):
        if not self.iniciado:
            self.surf = pygame.display.get_surface()
            if self.img != "":
                self.result = [0, 0]

                def elegido(d):
                    self.result = d

                d = InputDialog()

                d.setListener((elegido, ))

                print d.show("Eije el tamaño del puzzle", "Ancho", "")

                self.jugar(self.img, self.result)

        self.iniciado = True
Exemple #8
0
class Main(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.class1_SW_score = []
        self.class1_LA_score = []
        self.class2_SW_score = []
        self.class2_LA_score = []
        self.class_subject = []
        self.class_subject2 = []

        self.setData()
        self.initUI()
        self.drawGraph()

    def initUI(self):
        self.setWindowTitle("성적산출프로그램")
        self.setGeometry(650, 200, 750, 550)
        self.lblSubject = QLabel("과목 선택하기")
        font = self.lblSubject.font()
        font.setPointSize(font.pointSize() + 5)
        self.lblSubject.setFont(font)
        self.lblSubject.setFixedSize(150, 20)  # fixed widget size
        self.comboSubject = QComboBox()
        self.comboSubject.setFixedSize(150, 30)
        self.lblClass = QLabel("분반 선택하기")
        font = self.lblClass.font()
        font.setPointSize(font.pointSize() + 5)
        self.lblClass.setFont(font)
        self.comboClass = QComboBox()
        self.comboClass.setFixedSize(80, 30)
        self.comboSubject.addItems(['소프트웨어프로젝트2', '선형대수'])
        self.comboClass.addItems(['class1', 'class2'])
        self.comboClass.currentTextChanged.connect(self.comboClicked)
        self.comboSubject.currentTextChanged.connect(self.comboClicked)


        self.btnInputScore = QPushButton("점수 입력하기")
        self.btnInputScore.clicked.connect(self.btnInputScoreClicked)
        self.btnReset = QPushButton("점수 초기화")
        self.btnReset.clicked.connect(self.btnResetClicked)
        font = self.btnInputScore.font()
        font.setPointSize(font.pointSize() + 3)
        self.btnInputScore.setFont(font)
        self.btnInputScore.setFixedSize(200, 40)

        font = self.btnReset.font()
        font.setPointSize(font.pointSize() + 3)
        self.btnReset.setFont(font)
        self.btnReset.setFixedSize(200, 40)
        self.checkAll = QCheckBox("모든 분반 그래프 보기")
        font = self.checkAll.font()
        font.setPointSize(font.pointSize() + 3)
        self.checkAll.setFont(font)
        self.checkBoxNow = False    # 초기 combobox의 값 False로 설정
        self.checkAll.stateChanged.connect(self.checkBoxState)



        funcLayout = QVBoxLayout()
        funcLayout.addWidget(self.lblSubject)
        funcLayout.addSpacing(13)
        funcLayout.addWidget(self.comboSubject)
        funcLayout.addSpacing(15)
        funcLayout.addWidget(self.lblClass)
        funcLayout.addSpacing(13)
        funcLayout.addWidget(self.comboClass)
        funcLayout.addSpacing(65)
        funcLayout.addWidget(self.btnInputScore)
        funcLayout.addSpacing(10)
        funcLayout.addWidget(self.btnReset)
        funcLayout.addSpacing(60)
        funcLayout.addWidget(self.checkAll)
        funcLayout.setContentsMargins(20, 50, 0, 50)  # layout margins(left, top, right, bottom)

        # graph
        self.txtGraphTitle = QLabel("< " + self.comboSubject.currentText() + " > - " +
                                    self.comboClass.currentText() + " graph")
        font = self.txtGraphTitle.font()
        font.setPointSize(font.pointSize() + 3)
        self.txtGraphTitle.setFont(font)
        self.txtGraphTitle.setAlignment(Qt.AlignCenter)
        self.scores = [x for x in range(0, 100, 10)]
        self.people = [x for x in range(0, 12, 1)]
        self.fig = plt.Figure()
        self.fig.set_size_inches(4.5, 4.5)
        self.ax = self.fig.add_subplot(111)
        self.ax.set_xticks(self.scores)
        self.ax.set_yticks(self.people)
        self.canvas = FigureCanvas(self.fig)

        self.lblAverage = QLabel("평균 : ")
        font = self.lblAverage.font()
        font.setPointSize(font.pointSize() + 3)
        self.lblAverage.setFont(font)
        self.lblVariance = QLabel("표준편차 : ")
        font = self.lblVariance.font()
        font.setPointSize(font.pointSize() + 3)
        self.lblVariance.setFont(font)

        graphLayout = QVBoxLayout()
        graphLayout.addWidget(self.txtGraphTitle)
        graphLayout.addSpacing(10)
        graphLayout.addWidget(self.canvas)
        graphLayout.addSpacing(40)

        resultLayout = QHBoxLayout()
        resultLayout.addWidget(self.lblAverage)
        resultLayout.addWidget(self.lblVariance)
        resultLayout.setContentsMargins(50, 0, 0, 0)
        graphLayout.addLayout(resultLayout)
        graphLayout.setContentsMargins(0, 30, 20, 50)

        mainLayout = QGridLayout()
        mainLayout.addLayout(funcLayout, 0, 0)
        mainLayout.addLayout(graphLayout, 0, 1)

        self.setLayout(mainLayout)

    def checkBoxState(self):
        if self.checkAll.isChecked()==True:
            self.checkBoxNow = True
            self.drawAllGraph()


        else:
            self.checkBoxNow = False
            self.drawGraph()
    def comboClicked(self):
        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            self.txtGraphTitle.setText("< " + self.getSubKey() + " > - " +
                                       self.getClassKey() + " graph")

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            self.txtGraphTitle.setText("< " + self.getSubKey() + " > - " +
                                       self.getClassKey() + " graph")

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class2":
            self.txtGraphTitle.setText("< " + self.getSubKey() + " > - " +
                                       self.getClassKey() + " graph")

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            self.txtGraphTitle.setText("< " + self.getSubKey() + " > - " +
                                       self.getClassKey() + " graph")

    def lblAverage_sum(self, all_data):
        try:
            sum = 0
            for i in range(0, len(all_data)):
                sum += all_data[i]
            sum = sum / len(all_data)
            return round(sum, 1)

        except:
            return 0

    def lblVariance_sum(self, all_data, Average_data):
        try:
            sum = 0
            for i in range(0, len(all_data)):
                sum += (all_data[i] - Average_data) * (all_data[i] - Average_data)

            sum = sum / len(all_data)
            sum = math.sqrt(sum)
            return round(sum, 2)

        except:
            return 0

    # Subject comboBox의 key값 리턴
    def getSubKey(self):
        return self.comboSubject.currentText()

    # Class comboBox의 key값 리턴
    def getClassKey(self):
        return self.comboClass.currentText()

    # clicked btnInputScore -> dialog
    def btnInputScoreClicked(self):
        self.data = []
        self.setScore()
        self.dlg = InputDialog(self.data)  # 매개변수 self.data : dialog에 입력했던 점수를 불러오기 위한 장치
        self.dlg.exec_()
        self.dumpData()
        self.setData()
        if self.checkBoxNow == True:
            self.drawAllGraph()
        else:
            self.drawGraph()

    def btnResetClicked(self):
        n = []
        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            file = open('class1_SW_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            file = open('class1_LA_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class2":
            file = open('class2_SW_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            file = open('class2_LA_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        x = [10, 20, 30, 40, 50, 60, 70, 80, 90]
        y = [0, 0, 0, 0, 0, 0, 0, 0, 0]

        self.fig.clear()
        ax = self.fig.add_subplot(111)
        ax.set_xticks(self.scores)
        ax.set_yticks(self.people)
        ax.plot(x, y, label=self.getClassKey(), marker='o')
        #            ax.plot(x1, y1, label="class2", marker='o')

        ax.legend()  # 범례 표시
        self.lblAverage.setText("평균 : " + str(0))
        self.lblVariance.setText("표준편차 : " + str(0))
        self.canvas.draw()

    # 다이얼로그 창에서 받아온 점수리스트를 comboBox의 키 값에 따라 각각의 리스트에 점수 저장 & 텍스트파일에 값 저장
    def dumpData(self):
        n = self.dlg.btnOkClicked()  # dialog에 입력한 점수 리스트
        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            file = open('class1_SW_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            file = open('class1_LA_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class2":
            file = open('class2_SW_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            file = open('class2_LA_scoreDB.txt', 'wb')
            pickle.dump(n, file)

    # 텍스트파일에 저장되어있는 점수 불러오기
    def setData(self):
        if os.path.getsize('class1_SW_scoreDB.txt') > 0:
            file = open('class1_SW_scoreDB.txt', 'rb')
            self.class1_SW_score = pickle.load(file)
        else:
            pass

        if os.path.getsize('class1_LA_scoreDB.txt') > 0:
            file = open('class1_LA_scoreDB.txt', 'rb')
            self.class1_LA_score = pickle.load(file)
        else:
            pass

        if os.path.getsize('class2_SW_scoreDB.txt') > 0:
            file = open('class2_SW_scoreDB.txt', 'rb')
            self.class2_SW_score = pickle.load(file)
        else:
            pass

        if os.path.getsize('class2_LA_scoreDB.txt') > 0:
            file = open('class2_LA_scoreDB.txt', 'rb')
            self.class2_LA_score = pickle.load(file)
        else:
            pass

    # 각각의 파일에서 점수를 가져와서 다이얼로그 lineEdit에 점수 저장
    def setScore(self):
        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            if os.path.getsize('class1_SW_scoreDB.txt') > 0:
                file = open('class1_SW_scoreDB.txt', 'rb')
                self.data = pickle.load(file)

            else:
                self.data = []

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            if os.path.getsize('class1_LA_scoreDB.txt') > 0:
                file = open('class1_LA_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class2":
            if os.path.getsize('class2_SW_scoreDB.txt') > 0:
                file = open('class2_SW_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            if os.path.getsize('class2_LA_scoreDB.txt') > 0:
                file = open('class2_LA_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

    def drawGraph(self):
        num_min = 0
        num_max = 0
        num_scorelist = []
        num_scorelist_2 = []
        num_countlist = []
        count = 0

        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            while 0 in self.class1_SW_score:
                self.class1_SW_score.remove(0)
            if len(self.class1_SW_score) != 0:
                num_min = (min(self.class1_SW_score) // 10)
                num_max = (max(self.class1_SW_score) // 10)
                self.class_subject = self.class1_SW_score
            else:
                pass

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            while 0 in self.class1_LA_score:
                self.class1_LA_score.remove(0)
            if len(self.class1_LA_score) != 0:
                num_min = (min(self.class1_LA_score) // 10)
                num_max = (max(self.class1_LA_score) // 10)
                self.class_subject = self.class1_LA_score
            else:
                pass

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class2":
            while 0 in self.class2_SW_score:
                self.class2_SW_score.remove(0)
            if len(self.class2_SW_score) != 0:
                num_min = (min(self.class2_SW_score) // 10)
                num_max = (max(self.class2_SW_score) // 10)
                self.class_subject = self.class2_SW_score
            else:
                pass

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            while 0 in self.class2_LA_score:
                self.class2_LA_score.remove(0)
            if len(self.class2_LA_score) != 0:
                num_min = (min(self.class2_LA_score) // 10)
                num_max = (max(self.class2_LA_score) // 10)
                self.class_subject = self.class2_LA_score
            else:
                pass

        for i in range(num_min, num_max + 1):
            num_scorelist.append(i)

        for i in num_scorelist:
            for k in range(0, len(self.class_subject)):
                if (i * 10 <= self.class_subject[k]) and (self.class_subject[k] <= i * 10 + 9):
                    count += 1
            num_countlist.append(count)
            count = 0

        for i in range(0, len(num_scorelist)):
            num_scorelist_2.append(num_scorelist[i] * 10)

        x = num_scorelist_2
        y = num_countlist
        print(x, y)

        if (len(y) == 1 and y[0] == 0):
            x = [10, 20, 30, 40, 50, 60, 70, 80, 90]
            y = [0, 0, 0, 0, 0, 0, 0, 0, 0]

        self.fig.clear()
        ax = self.fig.add_subplot(111)
        ax.set_xticks(self.scores)
        ax.set_yticks(self.people)
        ax.plot(x, y, label=self.getClassKey(), marker='o')
        ax.legend()  # 범례 표시
        self.lblAverage.setText("평균 : " + str(self.lblAverage_sum(self.class_subject)))
        lblAverage_result = self.lblAverage_sum(self.class_subject)
        print(self.class_subject)
        self.lblVariance.setText("표준편차 : " + str(self.lblVariance_sum(self.class_subject, lblAverage_result)))
        self.canvas.draw()

    def drawAllGraph(self):
        num_min = 0
        num_max = 0
        num_scorelist = []
        num_scorelist_2 = []
        num_countlist = []
        count = 0


        if self.getSubKey() == "소프트웨어프로젝트2":
            while 0 in self.class1_SW_score:
                self.class1_SW_score.remove(0)
            if len(self.class1_SW_score) != 0:
                num_min = (min(self.class1_SW_score) // 10)
                num_max = (max(self.class1_SW_score) // 10)
                self.class_subject = self.class1_SW_score
            else:
                pass

        elif self.getSubKey() == "선형대수" :
            while 0 in self.class1_SW_score:
                self.class1_SW_score.remove(0)
            if len(self.class1_SW_score) != 0:
                num_min = (min(self.class1_LA_score) // 10)
                num_max = (max(self.class1_LA_score) // 10)
                self.class_subject = self.class1_LA_score
            else:
                pass




        for i in range(num_min, num_max + 1):
            num_scorelist.append(i)

        for i in num_scorelist:
            for k in range(0, len(self.class_subject)):
                if (i * 10 <= self.class_subject[k]) and (self.class_subject[k] <= i * 10 + 9):
                    count += 1
            num_countlist.append(count)
            count = 0

        for i in range(0, len(num_scorelist)):
            num_scorelist_2.append(num_scorelist[i] * 10)

        x = num_scorelist_2
        y = num_countlist
        print(x, y)

        if (len(y) == 1 and y[0] == 0):
            x = [10, 20, 30, 40, 50, 60, 70, 80, 90]
            y = [0, 0, 0, 0, 0, 0, 0, 0, 0]

        num_min = 0
        num_max = 0
        num_scorelist = []
        num_scorelist_2 = []
        num_countlist = []
        count = 0

        if self.getSubKey() == "소프트웨어프로젝트2":
            while 0 in self.class2_SW_score:
                self.class2_SW_score.remove(0)
            if len(self.class2_SW_score) != 0:
                num_min = (min(self.class2_SW_score) // 10)
                num_max = (max(self.class2_SW_score) // 10)
                self.class_subject2 = self.class2_SW_score
            else:
                pass

        elif self.getSubKey() == "선형대수":
            while 0 in self.class2_LA_score:
                self.class2_LA_score.remove(0)
            if len(self.class2_LA_score) != 0:
                num_min = (min(self.class2_LA_score) // 10)
                num_max = (max(self.class2_LA_score) // 10)
                self.class_subject2 = self.class2_LA_score
            else:
                pass

        for i in range(num_min, num_max + 1):
            num_scorelist.append(i)

        for i in num_scorelist:
            for k in range(0, len(self.class_subject2)):
                if (i * 10 <= self.class_subject2[k]) and (self.class_subject2[k] <= i * 10 + 9):
                    count += 1
            num_countlist.append(count)
            count = 0

        for i in range(0, len(num_scorelist)):
            num_scorelist_2.append(num_scorelist[i] * 10)

        x1 = num_scorelist_2
        y1 = num_countlist
        print(x1, y1)

        if (len(y1) == 1 and y1[0] == 0):
            x = [10, 20, 30, 40, 50, 60, 70, 80, 90]
            y = [0, 0, 0, 0, 0, 0, 0, 0, 0]

        self.fig.clear()
        ax = self.fig.add_subplot(111)
        ax.set_xticks(self.scores)
        ax.set_yticks(self.people)
        ax.plot(x, y, label="class1", marker='o')
        ax.plot(x1, y1, label="class2", marker='o')

        ax.legend()  # 범례 표시
        self.lblAverage.setText("평균 : " + str(self.lblAverage_sum(self.class_subject+ self.class_subject2)))
        lblAverage_result = self.lblAverage_sum(self.class_subject + self.class_subject2)
        print(self.class_subject + self.class_subject2)
        self.lblVariance.setText("표준편차 : " + str(self.lblVariance_sum(self.class_subject + self.class_subject2, lblAverage_result)))
        self.canvas.draw()
Exemple #9
0
class Main(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.class1_SW_score = []
        self.class1_LA_score = []
        self.class2_SW_score = []
        self.class2_LA_score = []
        self.setData()
        self.initUI()
        self.drawGraph()

    def initUI(self):
        self.setWindowTitle("성적산출프로그램")
        self.setGeometry(650, 200, 750, 550)
        self.lblSubject = QLabel("과목 선택하기")
        font = self.lblSubject.font()
        font.setPointSize(font.pointSize() + 5)
        self.lblSubject.setFont(font)
        self.lblSubject.setFixedSize(150, 20)  # fixed widget size
        self.comboSubject = QComboBox()
        self.comboSubject.setFixedSize(150, 30)
        self.lblClass = QLabel("분반 선택하기")
        font = self.lblClass.font()
        font.setPointSize(font.pointSize() + 5)
        self.lblClass.setFont(font)
        self.comboClass = QComboBox()
        self.comboClass.setFixedSize(80, 30)
        self.comboSubject.addItems(['소프트웨어프로젝트2', '선형대수'])
        self.comboClass.addItems(['class1', 'class2'])
        # self.comboClass.currentTextChanged.connect(self.comboClicked)
        # self.comboSubject.currentTextChanged.connect(self.comboClicked)

        self.btnInputScore = QPushButton("점수 입력하기")
        self.btnInputScore.clicked.connect(self.btnInputScoreClicked)
        self.btnReset = QPushButton("점수 초기화")
        font = self.btnInputScore.font()
        font.setPointSize(font.pointSize() + 3)
        self.btnInputScore.setFont(font)
        self.btnInputScore.setFixedSize(200, 40)

        font = self.btnReset.font()
        font.setPointSize(font.pointSize() + 3)
        self.btnReset.setFont(font)
        self.btnReset.setFixedSize(200, 40)

        # self.checkClass = QCheckBox("분반 별 그래프 보기")
        # font = self.checkClass.font()
        # font.setPointSize(font.pointSize() + 3)
        # self.checkClass.setFont(font)
        self.checkAll = QCheckBox("모든 분반 그래프 보기")
        font = self.checkAll.font()
        font.setPointSize(font.pointSize() + 3)
        self.checkAll.setFont(font)

        funcLayout = QVBoxLayout()
        funcLayout.addWidget(self.lblSubject)
        funcLayout.addSpacing(13)
        funcLayout.addWidget(self.comboSubject)
        funcLayout.addSpacing(15)
        funcLayout.addWidget(self.lblClass)
        funcLayout.addSpacing(13)
        funcLayout.addWidget(self.comboClass)
        funcLayout.addSpacing(65)
        funcLayout.addWidget(self.btnInputScore)
        funcLayout.addSpacing(10)
        funcLayout.addWidget(self.btnReset)
        funcLayout.addSpacing(60)
        # funcLayout.addWidget(self.checkClass)
        # funcLayout.addSpacing(10)
        funcLayout.addWidget(self.checkAll)
        funcLayout.setContentsMargins(
            20, 50, 0, 50)  # layout margins(left, top, right, bottom)

        #graph
        self.txtGraphTitle = QLabel("< " + self.comboSubject.currentText() +
                                    " > - " + self.comboClass.currentText() +
                                    " graph")
        font = self.txtGraphTitle.font()
        font.setPointSize(font.pointSize() + 3)
        self.txtGraphTitle.setFont(font)
        self.txtGraphTitle.setAlignment(Qt.AlignCenter)
        self.scores = [x for x in range(0, 100, 10)]
        self.people = [x for x in range(0, 12, 2)]
        self.fig = plt.Figure()
        self.fig.set_size_inches(4.5, 4.5)
        self.ax = self.fig.add_subplot(111)
        self.ax.set_xticks(self.scores)
        self.ax.set_yticks(self.people)
        self.canvas = FigureCanvas(self.fig)

        self.lblAverage = QLabel("평균 : ")
        font = self.lblAverage.font()
        font.setPointSize(font.pointSize() + 3)
        self.lblAverage.setFont(font)
        self.lblVariance = QLabel("분산 : ")
        font = self.lblVariance.font()
        font.setPointSize(font.pointSize() + 3)
        self.lblVariance.setFont(font)
        self.txtAverage = QLabel()
        self.txtVariance = QLabel()

        graphLayout = QVBoxLayout()
        graphLayout.addWidget(self.txtGraphTitle)
        graphLayout.addSpacing(10)
        graphLayout.addWidget(self.canvas)
        graphLayout.addSpacing(40)

        resultLayout = QHBoxLayout()
        resultLayout.addWidget(self.lblAverage)
        resultLayout.addWidget(self.txtAverage)
        resultLayout.addWidget(self.lblVariance)
        resultLayout.addWidget(self.txtVariance)
        resultLayout.setContentsMargins(50, 0, 0, 0)
        graphLayout.addLayout(resultLayout)
        graphLayout.setContentsMargins(0, 30, 20, 50)

        mainLayout = QGridLayout()
        mainLayout.addLayout(funcLayout, 0, 0)
        mainLayout.addLayout(graphLayout, 0, 1)

        self.setLayout(mainLayout)

    # Subject comboBox의 key값 리턴
    def getSubKey(self):
        return self.comboSubject.currentText()

    # Class comboBox의 key값 리턴
    def getClassKey(self):
        return self.comboClass.currentText()

    # clicked btnInputScore -> dialog
    def btnInputScoreClicked(self):
        self.data = []
        self.setScore()
        self.dlg = InputDialog(
            self.data)  # 매개변수 self.data : dialog에 입력했던 점수를 불러오기 위한 장치
        self.dlg.exec_()
        self.dumpData()
        self.setData()

    # 다이얼로그 창에서 받아온 점수리스트를 comboBox의 키 값에 따라 각각의 리스트에 점수 저장 & 텍스트파일에 값 저장
    def dumpData(self):
        n = self.dlg.btnOkClicked()  # dialog에 입력한 점수 리스트
        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            file = open('class1_SW_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            file = open('class1_LA_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey(
        ) == "class2":
            file = open('class2_SW_scoreDB.txt', 'wb')
            pickle.dump(n, file)

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            file = open('class2_LA_scoreDB.txt', 'wb')
            pickle.dump(n, file)

    # 텍스트파일에 저장되어있는 점수 불러오기
    def setData(self):
        if os.path.getsize('class1_SW_scoreDB.txt') > 0:
            file = open('class1_SW_scoreDB.txt', 'rb')
            self.class1_SW_score = pickle.load(file)
        else:
            pass

        if os.path.getsize('class1_LA_scoreDB.txt') > 0:
            file = open('class1_LA_scoreDB.txt', 'rb')
            self.class1_LA_score = pickle.load(file)
        else:
            pass

        if os.path.getsize('class2_SW_scoreDB.txt') > 0:
            file = open('class2_SW_scoreDB.txt', 'rb')
            self.class2_SW_score = pickle.load(file)
        else:
            pass

        if os.path.getsize('class2_LA_scoreDB.txt') > 0:
            file = open('class2_LA_scoreDB.txt', 'rb')
            self.class2_LA_score = pickle.load(file)
        else:
            pass

    # 각각의 파일에서 점수를 가져와서 다이얼로그 lineEdit에 점수 저장
    def setScore(self):
        if self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey() == "class1":
            if os.path.getsize('class1_SW_scoreDB.txt') > 0:
                file = open('class1_SW_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class1":
            if os.path.getsize('class1_LA_scoreDB.txt') > 0:
                file = open('class1_LA_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

        elif self.getSubKey() == "소프트웨어프로젝트2" and self.getClassKey(
        ) == "class2":
            if os.path.getsize('class2_SW_scoreDB.txt') > 0:
                file = open('class2_SW_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

        elif self.getSubKey() == "선형대수" and self.getClassKey() == "class2":
            if os.path.getsize('class2_LA_scoreDB.txt') > 0:
                file = open('class2_LA_scoreDB.txt', 'rb')
                self.data = pickle.load(file)
            else:
                self.data = []

    def drawGraph(self):

        x = [90, 80, 70, 60, 40]
        y = [2, 4, 6, 0, 2]

        x1 = [90, 80, 70, 60, 40]
        y1 = [4, 8, 2, 6, 1]

        self.fig.clear()
        ax = self.fig.add_subplot(111)
        ax.set_xticks(self.scores)
        ax.set_yticks(self.people)
        ax.plot(x, y, label="class1", marker='o')
        ax.plot(x1, y1, label="class2", marker='o')
        ax.legend()  # 범례 표시

        self.canvas.draw()