tight layout of dockarea

瀏覽次數:49 次
跳到第一則未讀訊息

Hanan Shteingart

未讀,
2015年10月23日 下午3:41:522015/10/23
收件者: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)

回覆所有人
回覆作者
轉寄
0 則新訊息