2

I am trying to format part of a suffix in a QDoubleSpinBox as a superscript. Thus far I have tried the following:

self.myDblSinBox.setSuffix("Nsm<sup>-4</sup>")

and:

self.myDblSinBox.setSuffix(r"Nsm$^{-4}$")

but without succes. Is there anyone who knows if this is possible? I am using Python 3.6, IPython 6.1, Spyder 3.2.3, and PyQt5.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Erik Thysell
  • 1,160
  • 1
  • 14
  • 31

1 Answers1

2

You can use unicode superscript characters for this:

self.myDblSinBoxsetSuffix(' Nsm\u207b\u2074')

enter image description here

ekhumoro
  • 115,249
  • 20
  • 229
  • 336