Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PyQt5: Python

PyQt5: Python

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 939 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Caeden
    wrote on last edited by
    #1

    I have a lineEdit:

    self.lineEdit = QtWidgets.QLineEdit(Dialog)
                    self.lineEdit.setGeometry(QtCore.QRect(20, 10, 541, 61))
                    self.lineEdit.setStyleSheet("QLineEdit{\n"
            "    border: 4px solid rgb(37, 39, 48);\n"
            "    border-radius: 30px;\n"
            "    color: black\n"
            "\n"
            "}")
                    self.lineEdit.setObjectName("lineEdit")
    self.lineEdit.setPlaceholderText("         Message")
    

    I set the placeholder text as Message with lots of spaces because it formats nicer. How Can I make it so that the text where the user inputs starts a little further out? Like an indent/marget.

    eyllanescE 1 Reply Last reply
    0
    • C Caeden

      I have a lineEdit:

      self.lineEdit = QtWidgets.QLineEdit(Dialog)
                      self.lineEdit.setGeometry(QtCore.QRect(20, 10, 541, 61))
                      self.lineEdit.setStyleSheet("QLineEdit{\n"
              "    border: 4px solid rgb(37, 39, 48);\n"
              "    border-radius: 30px;\n"
              "    color: black\n"
              "\n"
              "}")
                      self.lineEdit.setObjectName("lineEdit")
      self.lineEdit.setPlaceholderText("         Message")
      

      I set the placeholder text as Message with lots of spaces because it formats nicer. How Can I make it so that the text where the user inputs starts a little further out? Like an indent/marget.

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @Caeden Your question is unclear. Could you explain me better

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Caeden
        wrote on last edited by
        #3

        @eyllanesc Image of placeholder text

        That is the box with the placeholder text (There are lots of spaces)

        9324a990-f5a4-4afa-aef4-749ef878113c-image.png

        You see how the Id is intented but the but this is where the text starts isnt? How can I make it so that the but this is where the text starts starts from further along the text box

        eyllanescE 1 Reply Last reply
        0
        • C Caeden

          @eyllanesc Image of placeholder text

          That is the box with the placeholder text (There are lots of spaces)

          9324a990-f5a4-4afa-aef4-749ef878113c-image.png

          You see how the Id is intented but the but this is where the text starts isnt? How can I make it so that the but this is where the text starts starts from further along the text box

          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by
          #4

          @Caeden Use textMargins:

          import sys
          from PyQt5.QtWidgets import QApplication, QLineEdit
          
          
          def main():
              app = QApplication(sys.argv)
              lineedit = QLineEdit()
              margins = lineedit.textMargins()
              margins.setLeft(50)
              lineedit.setTextMargins(margins)
              lineedit.setText("Qt is awesome!!!")
              lineedit.show()
              sys.exit(app.exec_())
          
          
          if __name__ == "__main__":
              main()
          
          C 2 Replies Last reply
          1
          • eyllanescE eyllanesc

            @Caeden Use textMargins:

            import sys
            from PyQt5.QtWidgets import QApplication, QLineEdit
            
            
            def main():
                app = QApplication(sys.argv)
                lineedit = QLineEdit()
                margins = lineedit.textMargins()
                margins.setLeft(50)
                lineedit.setTextMargins(margins)
                lineedit.setText("Qt is awesome!!!")
                lineedit.show()
                sys.exit(app.exec_())
            
            
            if __name__ == "__main__":
                main()
            
            C Offline
            C Offline
            Caeden
            wrote on last edited by Caeden
            #5

            @eyllanesc Thanks very much :)
            edit: i now dont have a cap of 10 minutes for some reason

            mrjjM 1 Reply Last reply
            0
            • eyllanescE eyllanesc

              @Caeden Use textMargins:

              import sys
              from PyQt5.QtWidgets import QApplication, QLineEdit
              
              
              def main():
                  app = QApplication(sys.argv)
                  lineedit = QLineEdit()
                  margins = lineedit.textMargins()
                  margins.setLeft(50)
                  lineedit.setTextMargins(margins)
                  lineedit.setText("Qt is awesome!!!")
                  lineedit.show()
                  sys.exit(app.exec_())
              
              
              if __name__ == "__main__":
                  main()
              
              C Offline
              C Offline
              Caeden
              wrote on last edited by
              #6

              @eyllanesc How do I mark this as solved and give you a rep?

              eyllanescE 1 Reply Last reply
              0
              • C Caeden

                @eyllanesc How do I mark this as solved and give you a rep?

                eyllanescE Offline
                eyllanescE Offline
                eyllanesc
                wrote on last edited by
                #7
                This post is deleted!
                1 Reply Last reply
                0
                • C Caeden

                  @eyllanesc Thanks very much :)
                  edit: i now dont have a cap of 10 minutes for some reason

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Caeden said in PyQt5: Python:

                  edit: i now dont have a cap of 10 minutes for some reason

                  I bumped you.
                  Its a anti bot spammer measure and its clear you are not :)

                  C 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @Caeden said in PyQt5: Python:

                    edit: i now dont have a cap of 10 minutes for some reason

                    I bumped you.
                    Its a anti bot spammer measure and its clear you are not :)

                    C Offline
                    C Offline
                    Caeden
                    wrote on last edited by
                    #9

                    @mrjj ah okay thanks :) it was annoying lol

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved