Python Forum
[PyQt] manage display date
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] manage display date
#3
thanks for answer.

I have testing the code. It's working for me but :
when I write an incorrect date I have an error dispalyed at textEdit_error_display
if then I correct the date entered previously; the error message displays on textEdit_error_display, does not automatically clear
to solve this problematic I added this line of code :
 self.textEdit_error_display.setText("")
the complete code is :

import datetime as dt
 
def insert_date(self):
    try:
        d = int(self.lineEdit_day.text())
        m = int(self.lineEdit_month.text())
        y = int(self.lineEdit_year.text())
        date = dt.date(y, m, d)
    except ValueError:
        self.textEdit_error_display.setText("invalid fields")
    else:
        self.lineEdit_date_introduced.setText("{:%d/%m/%Y}".format(date))
		self.textEdit_error_display.setText("")
thanks for the code that helped me find a solution to my problem
Reply


Messages In This Thread
manage display date - by atlass218 - Nov-11-2019, 04:16 PM
RE: manage display date - by Gribouillis - Nov-11-2019, 04:37 PM
RE: manage display date - by atlass218 - Nov-11-2019, 09:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] display the contents of the table in descending order of the date atlass218 14 7,460 Nov-18-2019, 03:20 PM
Last Post: Denni
  Display and update the label text which display the serial value jenkins43 5 9,323 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 4,068 Jan-05-2019, 01:48 PM
Last Post: wuf

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020