Is it possible to add a pyqtgraph to a PySide app without using a QLayout? -


i want add pyqtgraph plot existing pyside application. of existing examples use qlayout of form achieve this:

from pyside import qtgui import sys import pyqtgraph app = qtgui.qapplication(sys.argv) my_widget = qtgui.qwidget() btn = qtgui.qpushbutton("my button", my_widget) plot = pyqtgraph.plotwidget() plotlayout = qtgui.qvboxlayout() plotlayout.addwidget(plot) my_widget.setlayout(plotlayout) my_widget.show() app.exec_() 

is possible add pyqtgraph plots widget without adding layout first? i'm guessing need because i'm trying add widget widget. pyqtgraph provide more qpushbutton or qlabel, can directly added widget?

the widget pyqtgraph.plotwidget() (which in above code). add parent widget other widgets pyqtgraph.plotwidget(parent) (see documentation list of constructor arguments). place @ coordinates (0,0) inside parents widget default size (i don't know size or how determined - have dimensions (0,0) or equally small).

however, typically hierarchy of objects in qt interface should follow widget -> layout -> widget -> layout -> widget ... (etc). allows multiple widgets placed inside widget , spaced , sized layout. without layouts, have try , manually specify coordinates , dimensions of each widget. possible (but cumbersome) long don't mind widgets not resizing when window size changes.

given small amount of overhead ensure widgets inside layouts, , layouts inside widgets, encourage follow pattern unless have specific reason not to.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -