Python Forum
Second window with buttons and plot - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Second window with buttons and plot (/thread-37614.html)



Second window with buttons and plot - frohr - Jun-30-2022

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


RE: Second window with buttons and plot - deanhystad - Jun-30-2022

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.