Nov-11-2019, 04:16 PM
I am trying to create a desktop application with QtDesigner and pyqt5.
I created a Groupbox with QtDesigner in which I put 03 lineEdit, successively for the day, month and year, a button to activate a function and a linedit with readonly option to display the complete introduced date.
Here are some pictures that reflect the result of my code: the first 03 pictures show a correct date but the 4th picture shows an incorrect date (the day is past 31 and the month is past 12)
correct display:
![[Image: u0c9.png]](https://zupimages.net/up/19/46/u0c9.png)
![[Image: 7590.png]](https://zupimages.net/up/19/46/7590.png)
![[Image: g7vl.png]](https://zupimages.net/up/19/46/g7vl.png)
incorrect display :
![[Image: cvp8.png]](https://zupimages.net/up/19/46/cvp8.png)
code python :
I created a Groupbox with QtDesigner in which I put 03 lineEdit, successively for the day, month and year, a button to activate a function and a linedit with readonly option to display the complete introduced date.
Here are some pictures that reflect the result of my code: the first 03 pictures show a correct date but the 4th picture shows an incorrect date (the day is past 31 and the month is past 12)
correct display:
![[Image: u0c9.png]](https://zupimages.net/up/19/46/u0c9.png)
![[Image: 7590.png]](https://zupimages.net/up/19/46/7590.png)
![[Image: g7vl.png]](https://zupimages.net/up/19/46/g7vl.png)
incorrect display :
![[Image: cvp8.png]](https://zupimages.net/up/19/46/cvp8.png)
code python :
def insert_date(self) : if (10<= int(self.lineEdit_day.text())<= 31 ) or (len(self.lineEdit_day.text())>1) : day_of_date=self.lineEdit_day.text() elif (1<=int(self.lineEdit_day.text())<=9 ) : day_of_date='0'+self.lineEdit_day.text() else: self.textEdit_error_display.setText("invalid fields") if (9<int(self.lineEdit_month.text() )<13) or (len(self.lineEdit_month.text())>1) : month_of_date=self.lineEdit_month.text() elif (1<=int(self.lineEdit_month.text() )<=9) : my_month='0'+self.lineEdit_month.text() else: self.textEdit_error_display.setText("invalid fields") year_of_date=self.lineEdit_year.text() self.lineEdit_date_introduced.setText(day_of_date + '/'+month_of_date+'/'+ year_of_date)thanks for help