def init_viewbox():
"""Helper function to init the ViewBox
"""
global win, vb
win = pg.GraphicsWindow()
win.ci.layout.setContentsMargins(0,0,0,0)
win.resize(200, 200)
win.show()
vb = win.addViewBox()
# set range before viewbox is shown
vb.setRange(xRange=[0, 10], yRange=[0, 10], padding=0)
# required to make mapFromView work properly.
qtest.qWaitForWindowShown(win)
g = pg.GridItem()
vb.addItem(g)
app.processEvents()
评论列表
文章目录