Interface to plot points on a graph with matplotlib

0

Good afternoon guys, I use pyqt4 and python 2.7. How do I create what I described in the title? I'm a beginner, forgive me if my programming or explanation is not the best. Below is the code I have so far

class AppCAD(qg.QMainWindow):

    def __init__(self, parent=None):
        qg.QMainWindow.__init__(self, parent)
        self.setWindowTitle('CAD Input Python')
        self.setGeometry(100,100,800,600)
        self.create_main_frame()      

    def create_main_frame(self): #cria canvas, botão de plotar e 2 caixas para inserção de plotagem
        self.main_frame = qg.QWidget()

        self.dpi = 70
        self.fig = Figure((5.0, 5.0), dpi=self.dpi)
        self.canvas = FigureCanvas(self.fig)
        self.axes = self.fig.add_subplot(111)
        self.axes.axis('equal')

        self.axes.set_xlim(-10,10)
        self.axes.set_ylim(-10,10)
        self.axes.xaxis.set_major_locator(plt.MultipleLocator(5.0))
        self.axes.xaxis.set_minor_locator(plt.MultipleLocator(1.0))
        self.axes.yaxis.set_major_locator(plt.MultipleLocator(5.0))
        self.axes.yaxis.set_minor_locator(plt.MultipleLocator(1.0))
        self.axes.grid(which='major', axis='x', linewidth=0.75, linestyle='-', color='0.75')
        self.axes.grid(which='minor', axis='x', linewidth=0.25, linestyle='-', color='0.75')
        self.axes.grid(which='major', axis='y', linewidth=0.75, linestyle='-', color='0.75')
        self.axes.grid(which='minor', axis='y', linewidth=0.25, linestyle='-', color='0.75')

        self.buttonA = qg.QPushButton("Plotar")
        self.obj = qg.QLineEdit()
        self.obj1 = qg.QLineEdit()

        self.connect(self.buttonA, qc.SIGNAL('clicked()'), self.press_buttonA)
        self.main_frame.setLayout(grid)
        self.setCentralWidget(self.main_frame)   
        grid = qg.QGridLayout()
        grid.addWidget(self.buttonA,4,0)
        grid.addWidget(self.canvas,0,1,3,3)  
        grid.addWidget(self.obj, 0,0)
        grid.addWidget(self.obj1, 0,1)
    # Coordenadas -------------------------------------------------------------
    def i2o_coordenadas(self):
        self.coord = []
        self.cx = float(self.obj.text())
        self.cy = float(self.obj1.text())
        self.coord.append([self.cx,self.cy])


    def press_buttonA(self):


def main():
    app = qg.QApplication(sys.argv)
    form = AppCAD()
    form.show()
    app.exec_()

if __name__ == "__main__":
    main()
    
asked by anonymous 21.08.2018 / 19:27

0 answers