tight layout of dockarea

49 views
Skip to first unread message

Hanan Shteingart

unread,
Oct 23, 2015, 3:41:52 PM10/23/15
to pyqtgraph
Hi,

I am new here so sorry if I ask a too easy question.
I am trying to use dockarea but I cannot find any proper documentation of the init function.
Anyway, I am trying to put a table in one dock (left) and a plot on the other (right).
The problem is that the docks takes half of the window by default.
I am trying to find a way to resize the dock so it tightly occupy the widget inside it. 
Currently I have a layout widget in each dock and a table widget on the left dock and a plot widget on the right dock.
I've tried to play with geometry properties but it doesn't seem the right answer.  How do I define the DockArea layout?
Thanks,
Hanan

The code looks something like:

dock_area = DockArea()
mw
.setCentralWidget(dock_area)
dock_metadata
= Dock("Table") ## give this dock the minimum possible size
dock_data
= Dock("Plot")
dock_area
.addDock(dock_metadata, 'left') ## place metadata on the left (it will fill the whole space since there are no other docks yet)
dock_area
.addDock(dock_data, 'right', dock_metadata) ## place data at right edge of metadata
# set metadata dock widget content
layout_metadata
= pg.LayoutWidget()
tw
= pg.TableWidget()
layout_metadata
.addWidget(tw)
dock_metadata
.addWidget(layout_metadata)
# set data dock widget content
layout_data
= pg.LayoutWidget()
pw
= pg.PlotWidget(name='Plot', axisItems={'bottom': DateAxisItem(orientation='bottom')}) ## giving the plots names allows us to link their axes together
layout_data.addWidget(pw)
dock_data.addWidget(layout_data)

Reply all
Reply to author
Forward
0 new messages