Python Forum

Full Version: Second window with buttons and plot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I have main window and if I click on button then second window will open. In second window I will have buttons and text fields on the left and one plot on the right side. This is my code now:

class SecondWindow(QWidget):
    def __init__(self):
        super().__init__()                          
        self.setMinimumSize(600,300)   
        self.setWindowTitle("Second Window")
        self.label1 = QLabel("Value1: ", self)          
        self.label1.setGeometry(20, 20, 150, 20)
        self.edit1 = QLineEdit("", self)
        self.edit1.setGeometry(160, 20, 50, 20)
If I add code for circle (below) nothing happened.
How to add plot on the right side of this window?

Circle:
        figure, axes = plt.subplots()
        Drawing_uncolored_circle = plt.Circle( (0.6, 0.6 ), 0.3 ,fill = False )
 
        axes.set_aspect( 1 )
        axes.add_artist( Drawing_uncolored_circle )
        plt.title( 'Circle' )
        plt.draw()
Thanks
What is plt? Are you using matplotlib?

If you want the plot to be visible you need to call show(). draw() is used to update a plot, not draw it to the screen.