Python Forum

Full Version: PyQt4 text edit align text center
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

Is there a way of aligning the text in a text edit widget so that it is centered? There is no way of doing this in the Designer, and I have tried:
self.textwidget.setAlignment(QtCore.Qt.AlignCenter
like it says in the docs, however it doesn't seem to work, as there is no error, but text is still left aligned. What is the correct syntax for this assuming importing done like this:
from PyQt4 import QtGui
from PyQt4 import QtCore
Thanks
Did you have the close parenthesis after AlignCenter ?
yes, sorry I do, just the close one.