Python Forum
PyQT4 only upper case text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyQT4 only upper case text
#1
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?
Reply
#2
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] PyQt4 dynamic QComboBox littleGreenDude 4 5,696 Jan-02-2019, 07:22 PM
Last Post: littleGreenDude
  [PyQt] PyQt4 handle dynamic checkbox click littleGreenDude 1 6,596 Dec-27-2018, 09:17 PM
Last Post: littleGreenDude
  PyQt4 installation frustration littleGreenDude 4 4,549 Dec-27-2018, 04:29 PM
Last Post: littleGreenDude
  [PyQt4] Is it right python coding scheme between TCP Server Thread and GUI class ? KimTom 3 3,269 Sep-18-2018, 01:21 PM
Last Post: Alfalfa
  How to Integrate PyQt4 Custom Widget with Qt Designer Zukias 1 3,922 Aug-29-2018, 05:33 PM
Last Post: Zukias
  Updating Python version from command prompt and Conversion from PyQt4 to PyQt5 Vysero 4 4,970 Jul-19-2018, 03:15 PM
Last Post: Vysero
  Trouble displaying an image in PyQt4 Vysero 2 3,107 Jul-01-2018, 05:25 PM
Last Post: Alfalfa
  [PyQt] problem with PyQt4 jss15497 0 2,770 Jan-16-2018, 08:32 AM
Last Post: jss15497
  [PyQt] Learn pyqt5 using pyqt4 jimclay75051 5 5,816 Nov-13-2017, 06:29 AM
Last Post: zykbee
  PyQt4 text edit align text center iFunKtion 3 15,005 Mar-10-2017, 06:02 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020