[PyQt] Simple QFontMetrics example crashes Python!

David Boddie david at boddie.org.uk
Fri Feb 27 20:47:08 GMT 2015


On Fri, 27 Feb 2015 12:08:40 -0800, Nathan McCorkle wrote:

> Am I doing something wrong? I can't find info on whether I can do this
> without having a GUI running (I am working on a drawing application
> which is all terminal/non-GUI based).
> 
> from PyQt5 import QtGui
> f = QtGui.QFont("times", 24)
> fm = QtGui.QFontMetrics(f)
> fm.width("whatup dawg???")

Does it still crash if you create a QApplication instance before trying to
read the metrics?

David


More information about the PyQt mailing list