[PyQt] Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4

Lukas Hetzenecker LuHe at gmx.at
Mon Jul 20 20:58:46 BST 2009


Hm.. I added a resize() after the show():

class Plot_tab(QTabWidget, tab):
    def __init__(self):
        super(Plot_tab, self).__init__()
        self.setupUi(self)

        self.show()
        self.resize(self.size().width()+1, self.size().height()+1)
        self.resize(self.size().width()-1, self.size().height()-1)

if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)

    plot_t = Plot_tab()

    sys.exit(app.exec_())


Now it works, but I really want to know why..?
Is there a way to avoid this ugly workaround?

Thanks,
Lukas

Am Sonntag 19 Juli 2009 12:58:53 schrieb Lukas Hetzenecker:
> Hello,
>
> I've tried to resize the QTabWidget, I've searched for examples on the
> internet, added a QTabWidget and used this as the Mainwindows central
> widget - but exactly the same happened.
>
> It works if I replace the FigureCanvas with a Qt Widget - for example a
> text edit or a QWebView.
>
> Am Sonntag 19 Juli 2009 11:54:12 schrieb projetmbc:
> > Lukas Hetzenecker a écrit :
> > > I tried to embed a Matplotlib FigureCanvas into a QTabWidget.
> > > But at the first start of my script - the main.py in the attatched
> > > example - the widget in the Tab is incorrectly sized.
> > > If I embed the FigureCanvas in a QTabWidget the widget is to big, but
> > > if I put it in a QWidget it is shown correctly.
> >
> > I'm not sure that is a pure MatPlotLib issue. Have you try with a big
> > standard widget instead of the FigureCanvas ?
> >
> > Christophe
>
> ---------------------------------------------------------------------------
>--- Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users




More information about the PyQt mailing list