Python Forum

Full Version: PyQT4 only upper case text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

Due to the nature of our company font, we never ever want to use it lowercase. Is there a way of making absolutely every bit of text in an application no matter how large to be only upper case. I know in python, you just use .upper when working with text, and that is a simple thing to add on. But I can't work out how this could be done with Qt. Is there a way of putting something in the init method of the main window that will then get inherited everywhere?
You could create a method that returns upper case string, and everytime you want to put in text, you just call that method.
Example of such method:
def upper_case(self, string_input):
    return string_input.upper()
Now, when you create a label for example, instead of a string, you will put the method that returns upper case string.
# some code
self.label.setText(self.upper_case("upper case label"))
# some more code