Issue
I need to plot on the predefined part of the ui with PySide6. The ui is designed with Qt Creator and it contains a widget called "widgetGraph". If I'm using the following example it works, but due to the set of the central widget everything on the ui gets overwritten
self.ui.widgetGraph = pyqtgraph.PlotWidget()
self.ui.setCentralWidget(self.ui.widgetGraph)
hour = [1,2,3,4,5,6,7,8,9,10]
temperature = [30,32,34,32,33,31,29,32,35,45]
# plot data: x, y values
self.ui.widgetGraph.plot(hour, temperature)
Without using the "setCentralWidget" function the widget remains empty. Is there any way not to override the ui elements, just plot into the previously mentioned "widgetGraph" widget?
Solution
As stated in the answer from @musicamante, the plot widget has to added to the layout with the following code:
self.ui.someLayout.addWidget(self.ui.widgetGraph)
Answered By - Jatson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.