PyQt5: Python
-
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
Messagewith 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. -
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
Messagewith 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. -
That is the box with the placeholder text (There are lots of spaces)

You see how the Id is intented but the
but this is where the text startsisnt? How can I make it so that thebut this is where the text startsstarts from further along the text box -
That is the box with the placeholder text (There are lots of spaces)

You see how the Id is intented but the
but this is where the text startsisnt? How can I make it so that thebut this is where the text startsstarts from further along the text box@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() -
@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()@eyllanesc Thanks very much :)
edit: i now dont have a cap of 10 minutes for some reason -
@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()@eyllanesc How do I mark this as solved and give you a rep?
-
@eyllanesc How do I mark this as solved and give you a rep?
-
@eyllanesc Thanks very much :)
edit: i now dont have a cap of 10 minutes for some reason@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 :) -
@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 :)
