我惊讶地发现仅仅存在一个断点就可以改变 pyqtgraph 对象(python2.7)的行为。
这是一个最小的工作示例:
import pyqtgraph as pg
pg.mkQApp()
pw = pg.PlotWidget()
p1 = pw.plotItem
p1.showAxis('right')
#import pdb; pdb.set_trace() # Running once with this line, once without
print p1.getAxis('right').rect().width()
运行:
# No breakpoint:
% python qtg_pdb_bug.py
0.0
# With breakpoint:
% python qtg_pdb_bug.py
> qtg_pdb_bug.py(7)<module>()
-> print p1.getAxis('right').rect().width()
(Pdb) c
35.0
问题:
- 出于好奇:在导致这种奇怪的断点处停止时会发生什么?这是 pyqtgraph 中的错误吗?
- 哪个是正确/预期的结果?0 还是 35?