• <small id='6b34M'></small><noframes id='6b34M'>

    <legend id='6b34M'><style id='6b34M'><dir id='6b34M'><q id='6b34M'></q></dir></style></legend>
    • <bdo id='6b34M'></bdo><ul id='6b34M'></ul>

    <i id='6b34M'><tr id='6b34M'><dt id='6b34M'><q id='6b34M'><span id='6b34M'><b id='6b34M'><form id='6b34M'><ins id='6b34M'></ins><ul id='6b34M'></ul><sub id='6b34M'></sub></form><legend id='6b34M'></legend><bdo id='6b34M'><pre id='6b34M'><center id='6b34M'></center></pre></bdo></b><th id='6b34M'></th></span></q></dt></tr></i><div id='6b34M'><tfoot id='6b34M'></tfoot><dl id='6b34M'><fieldset id='6b34M'></fieldset></dl></div>
      1. <tfoot id='6b34M'></tfoot>

        在 PyQt5 中,如何将普通的 QLineEdit(文本框)转换为

        时间:2023-08-04

          • <bdo id='Fz4HK'></bdo><ul id='Fz4HK'></ul>

                <tbody id='Fz4HK'></tbody>
              <i id='Fz4HK'><tr id='Fz4HK'><dt id='Fz4HK'><q id='Fz4HK'><span id='Fz4HK'><b id='Fz4HK'><form id='Fz4HK'><ins id='Fz4HK'></ins><ul id='Fz4HK'></ul><sub id='Fz4HK'></sub></form><legend id='Fz4HK'></legend><bdo id='Fz4HK'><pre id='Fz4HK'><center id='Fz4HK'></center></pre></bdo></b><th id='Fz4HK'></th></span></q></dt></tr></i><div id='Fz4HK'><tfoot id='Fz4HK'></tfoot><dl id='Fz4HK'><fieldset id='Fz4HK'></fieldset></dl></div>

              <tfoot id='Fz4HK'></tfoot>

                <small id='Fz4HK'></small><noframes id='Fz4HK'>

              • <legend id='Fz4HK'><style id='Fz4HK'><dir id='Fz4HK'><q id='Fz4HK'></q></dir></style></legend>
                • 本文介绍了在 PyQt5 中,如何将普通的 QLineEdit(文本框)转换为完美的大写/大写 QLineEdit 框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何在入门级将我的 QLineEdit 转换为大写或全部大写?

                  How to convert My QLineEdit into a Capitalize or all upper Case at Entry Level ?

                  (如果我在我的文本框(QLineEdit)中输入字符串,它会根据用户定义的方法自动将输入字符串转换或格式化.(大写或大写))

                  ( If I enter string into my text box (QLineEdit), automatically its converts or format the input string to, as per user defined method. ( Capitalize or Upper Case ))

                  import sys
                  from PyQt5.QtWidgets import *
                  from PyQt5.QtGui import *
                  
                  
                  class textbox_example(QWidget):
                      def __init__(self):
                          super().__init__()
                          self.setWindowTitle(" QLine Edit Example")
                          self.setGeometry(50, 50, 1500, 600)
                  
                          self.tbx_search = QLineEdit(self)
                          self.tbx_search.setGeometry(50, 50, 300, 30)
                          self.tbx_search.setPlaceholderText("Enter,Name of the Company")
                          self.tbx_search.setFont(QFont("caliber", 10, QFont.Capitalize))
                  
                  def main():
                      myapp = QApplication(sys.argv)
                      mywindow = textbox_example()
                      mywindow.show()
                      sys.exit(myapp.exec_())
                  
                  
                  if __name__ == "__main__":
                      main()
                  

                  如果我输入公司名称为google inc",则其转换如下Google Inc".

                  If I enter a name of the company as "google inc" then its converts as follows " Google Inc" .

                  推荐答案

                  以下代码对我来说很好.我也是 PyQt5 和 Python 的新手.所以如果你能让这个更pythonic,请告诉我

                  The following code works to me fine. I am also new to PyQt5 and Python. so if you can make this more pythonic please let me know

                  import sys
                  from PyQt5.QtWidgets import *
                  
                  class textbox_example(QWidget):
                      def __init__(self):
                          super().__init__()
                          self.setWindowTitle(" QLine Edit Example")
                          self.setGeometry(50, 50, 1500, 600)
                  
                          self.tbx_search = QLineEdit(self)
                          self.tbx_search.setGeometry(50, 50, 300, 30)
                          self.tbx_search.setPlaceholderText("Enter,Name of the Company")
                          self.tbx_search.textChanged.connect(self.auto_capital)
                  
                      def auto_capital(self, txt):
                          cap_text = txt.title()  
                          upp_text = txt.upper()  # All Upper Case
                          self.tbx_search.setText(cap_text)
                  
                  def main():
                      myapp = QApplication(sys.argv)
                      mywindow = textbox_example()
                      mywindow.show()
                      sys.exit(myapp.exec_())
                  
                  if __name__ == "__main__":
                      main()
                  

                  这篇关于在 PyQt5 中,如何将普通的 QLineEdit(文本框)转换为完美的大写/大写 QLineEdit 框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:python.exe:没有名为 pyuic5 的模块 下一篇:复制到剪贴板的图像不会在 Linux 上保留

                  相关文章

                  最新文章

                  <tfoot id='yJ6iF'></tfoot>

                    <small id='yJ6iF'></small><noframes id='yJ6iF'>

                      <bdo id='yJ6iF'></bdo><ul id='yJ6iF'></ul>
                      <legend id='yJ6iF'><style id='yJ6iF'><dir id='yJ6iF'><q id='yJ6iF'></q></dir></style></legend>

                    1. <i id='yJ6iF'><tr id='yJ6iF'><dt id='yJ6iF'><q id='yJ6iF'><span id='yJ6iF'><b id='yJ6iF'><form id='yJ6iF'><ins id='yJ6iF'></ins><ul id='yJ6iF'></ul><sub id='yJ6iF'></sub></form><legend id='yJ6iF'></legend><bdo id='yJ6iF'><pre id='yJ6iF'><center id='yJ6iF'></center></pre></bdo></b><th id='yJ6iF'></th></span></q></dt></tr></i><div id='yJ6iF'><tfoot id='yJ6iF'></tfoot><dl id='yJ6iF'><fieldset id='yJ6iF'></fieldset></dl></div>