Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

No Canvas item (or anything else to visualize python figures) in Qt Creator



  • Dear all,

    I just transitioned to Qt5 and the new Qt Creator.

    On Qt4 and the old Qt Designer, there was a MatplotlibWidget, that I could use with python/pyQt to visualize my python generated figures.

    However, I can not find a way for this in the new Qt Creator. Most solutions I found to treat my problem needed a Canvas item, which is non-existent in my Qt Creator. Is this a Creator bug or am I doing something wrong?

    The only thing I wanna do: matplotlib.pyplot.imshow(someData) and see this in mt Qt Window.

    Best regards,

    gbrown


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That's unrelated to Qt Creator.

    Do you meant that MatplotlibWidget ?



  • Hi thanks for the quick answer!
    Sorry if it is unrelated to Qt Creator, but at least IN the old Qt Designer, there already was this MatplotlibWidget that I could just drag and drop. This was then a part of the saved .ui file.

    I am not sure how this would work with the link you provided. It seems like something, that I would create within the python code and not in the Qt Creator?


  • Lifetime Qt Champion

    The link from my question was to know whether it was what you were using.

    As for your old setup, you likely had a package installed that provided a Qt Designer plugin for that widget. So if you still have it around, I'd start by checking what packages you had installed that provided that and see if it still available for your more recent setup.



  • Ah I see. Unfortunately, in the old setup, we used a huge collection of packages, called python(x,y), which delivers the Qt Designer already with a MatplotlibWidget. I don't know, where I would find the exact files needed for this and I also cannot tell, if the linked class is the one, that has been used.

    I have also tried to copy the corresponding matplotlibwidget.py files into the Qt plugins directory... however, I still don't see any item in the Qt Creator, that I can use to plot my figures into : (

    I would also be glad about any other approach, how to plot my python figures with anything provided by the Qt Creator itself.


  • Lifetime Qt Champion

    Qt Designer (and Qt Creator for that matter) plugins are written in C++ not python.

    Again, it's not a Qt Creator issue. Qt Creator is only an IDE. That package you were using provided a plugin that allowed to integrate its stuff more easily.

    Since you already know the class you want to use, you can still build your UI although with a bit more manual code.

    Again, I'd recommend checking whether that collection of package still is available.



  • Alright, thanks for the help. I guess, there is no way around some manual code for the UI.

    Thanks!


Log in to reply