Skip to content

AttributeError: 'QwtScaleWidget' object has no attribute 'maxMajor' / 'maxMinor' / 'stepSize' #72

@jkaercher

Description

@jkaercher

Hi,

QwtPlot.axisMaxMinor and QwtPlot.axisStepSize access their respective attributes from self.axisWidget(axisId). This results in these exceptions:

Traceback (most recent call last):
  File "/tmp/example.py", line 13, in <module>
    plot.axisMaxMinor(qwt.QwtPlot.xBottom)
  File "/opt/conda/envs/bnpython/lib/python3.10/site-packages/qwt/plot.py", line 603, in axisMaxMinor
    return self.axisWidget(axisId).maxMinor
AttributeError: 'QwtScaleWidget' object has no attribute 'maxMinor'
Traceback (most recent call last):
  File "/tmp/example.py", line 16, in <module>
    plot.axisStepSize(qwt.QwtPlot.xBottom)
  File "/opt/conda/envs/bnpython/lib/python3.10/site-packages/qwt/plot.py", line 644, in axisStepSize
    return self.axisWidget(axisId).stepSize
AttributeError: 'QwtScaleWidget' object has no attribute 'stepSize'

Looks like both methods should access from self.__axisData[axisId] instead.

Example code to reproduce the exceptions:

import sys

from PyQt5 import QtWidgets
import qwt

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)

    plot = qwt.QwtPlot()

    # exception 1:
    plot.axisMaxMinor(qwt.QwtPlot.xBottom)

    # exception 2:
    plot.axisStepSize(qwt.QwtPlot.xBottom)

    plot.show()
    sys.exit(app.exec_())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions