Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to set text in qdateedit pyqt5

from PyQt5 import QtCore, QtWidgets


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)

    date_str = "1-Jan-2020"
    # convert str to QDate
    qdate = QtCore.QDate.fromString(date_str, "d-MMM-yyyy")

    widget_date = QtWidgets.QDateEdit()
    # Set the format of how the QDate will be displayed in the widget
    widget_date.setDisplayFormat("d-MMM-yyyy")

    widget_date.setDate(qdate)
    
    widget_date.show()
    
    sys.exit(app.exec_())
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #text #qdateedit
ADD COMMENT
Topic
Name
5+1 =