0

I see in a .ui file tipicali generate with qt that you can create you widget with your class, but idk how to create a class with the paramether, then i decide to create in in python. The focus of the widget is show a Graph, that i see that you can use pyqtgraph but i don't know how to add it on a class, i see that in a .ui file generate with qt you have the possibility to add an header to your class.

Code in the .ui file:

<customwidgets>
  <customwidget>
   <class>PlotWidget</class>
   <extends>QWidget</extends>
   <header>pyqtgraph</header>
   <container>1</container>
  </customwidget>
 </customwidgets>

I try to see some tutorial on web but i didn't find a method to translate it in a Python code.

In my try i wrote this:

from PyQt5.QtWidgets import QWidget
from PyQt5 import QtCore
import pyqtgraph as pg

class MyGraphs(QWidget):
    def __init__(self, name) -> None:
        super().__init__()
        self.setGeometry(10,10,271,201)
        self.setObjectName(name)
        self.setStyleSheet("background-color: white")
        self.setVisible(True)

I cannon't use the command pyqtgraph in my new widget. maybe i don't know if i added the widget properly to my gui (made with .ui file) because i cannont see noffing on the screen

Someone can help me? thank you very much.

Basil
  • 659
  • 4
  • 11

0 Answers0