Issue clearing text from a multiline text field

46 views
Skip to first unread message

Quantumrobs

unread,
Jan 13, 2022, 2:34:06 PM1/13/22
to Kivy users support
Hello. I am trying to clear text fields before leaving a screen. I am able to clear non-multiline fields, but for some reason, I cannot clear the text in the multiline text field.

I am able to use the multiline text input by users for uploads to a database, as well as assign it to variables, but it will not clear using a simple self.ids.add_notes_text.text = "". (The ID of the text field is add_notes_text.)

Is there a different way to do it since it is a multiline text field?

Thanks for the assistance.

Elliot Garbus

unread,
Jan 13, 2022, 2:48:39 PM1/13/22
to kivy-...@googlegroups.com

That should work.  Do you have a small runnable example.  Perhaps something else is going on.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/51461ee0-64e9-492a-b539-9c5479ee7811n%40googlegroups.com.

 

Quantumrobs

unread,
Jan 13, 2022, 3:08:48 PM1/13/22
to Kivy users support
Hi Elliot,

Thank you for getting back to me regarding this issue. The error I printed out while running the script is  'super' object has no attribute '__getattr__'

Attached is the snippet of the .py code and .kv code pertaining to this particular field and function. This particular field is inside a ScrollView, but I am still referencing it the same way I am further up the code when I assign the text to upload to the database, which works fine. I would not think there is a difference in referencing the text in the clear function versus the function grabbing the text for the database. I am using the same reference in both, and both are in the same function.

Thanks.Screenshot (14).png
Screenshot (15).png

Elliot Garbus

unread,
Jan 13, 2022, 4:00:52 PM1/13/22
to kivy-...@googlegroups.com

There is not enough context to see the issue.  Please share a minimal, runnable example.

 

 

From: Quantumrobs
Sent: Thursday, January 13, 2022 1:09 PM
To: Kivy users support
Subject: Re: [kivy-users] Issue clearing text from a multiline text field

 

Hi Elliot,

 

Thank you for getting back to me regarding this issue. The error I printed out while running the script is  'super' object has no attribute '__getattr__'

 

Attached is the snippet of the .py code and .kv code pertaining to this particular field and function. This particular field is inside a ScrollView, but I am still referencing it the same way I am further up the code when I assign the text to upload to the database, which works fine. I would not think there is a difference in referencing the text in the clear function versus the function grabbing the text for the database. I am using the same reference in both, and both are in the same function.

 

Thanks.

 

On Thursday, January 13, 2022 at 2:48:39 PM UTC-5 ElliotG wrote:

That should work.  Do you have a small runnable example.  Perhaps something else is going on.

 

From: Quantumrobs
Sent: Thursday, January 13, 2022 12:34 PM
To: Kivy users support
Subject: [kivy-users] Issue clearing text from a multiline text field

 

Hello. I am trying to clear text fields before leaving a screen. I am able to clear non-multiline fields, but for some reason, I cannot clear the text in the multiline text field.

 

I am able to use the multiline text input by users for uploads to a database, as well as assign it to variables, but it will not clear using a simple self.ids.add_notes_text.text = "". (The ID of the text field is add_notes_text.)

 

Is there a different way to do it since it is a multiline text field?

 

Thanks for the assistance.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/51461ee0-64e9-492a-b539-9c5479ee7811n%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

Screenshot (14).png

Quantumrobs

unread,
Jan 13, 2022, 4:46:37 PM1/13/22
to Kivy users support
Thank you again for the assistance, Elliot,

I copied the code snippet from this particular screen (from  the .py) and the snippet for this same screen from the kivy file. I am sorry if the code is long, but I want to make sure you can see the rest of what is going with the screen.

Thank you.


FROM THE .PY FILE (I removed the database password due to the public forum):

class AddParticipantScreen3(MDScreen):
    user_rights_dialog = None
    missing_data_dialog = None
    date_error_dialog = None

    def add_participantid_screen3(self):
        mydb = mysql.connector.connect(host='sql5.freemysqlhosting.net',
                                       database='sql5460613',
                                       user='sql5460613',
                                       password='')

        cursor = mydb.cursor(buffered=True)
        query = "SELECT * from tempparticipants"
        cursor.execute(query)
        current_add_participant_id = cursor.fetchone()
        cursor.close()
        mydb.close()
        if current_add_participant_id is None:
            self.manager.current = "addparticipantscreen3"
        else:
            self.ids.add3_participant_id.text = current_add_participant_id[0]

    def user_change_rights(self):
        if LoginScreen.login_username == "Admin":
            self.manager.current = "userscreen"
        else:
            self.no_user_access_alert()

    def no_user_access_alert(self):
        if not self.user_rights_dialog:
            self.user_rights_dialog = MDDialog(
                title="User Change Rights Notice",
                text="You do not have the user rights to add, change or delete user credentials.",
                buttons=[
                    MDRectangleFlatButton(
                        text="OK", on_release=self.close_user_rights_dialog),
                ],
            )
        self.user_rights_dialog.open()

    def close_user_rights_dialog(self, *args):
        self.dialog.dismiss()

    def missing_fields_alert(self):
        if not self.missing_data_dialog:
            self.missing_data_dialog = MDDialog(
                title="Missing Data Notice",
                text="There are requried fields missing data. Please add data before moving to next screen.",
                buttons=[
                    MDRectangleFlatButton(
                        text="OK", on_release=self.close_missing_data_dialog),
                ],
            )
        self.missing_data_dialog.open()

    def close_missing_data_dialog(self, *args):
        self.missing_data_dialog.dismiss()
        self.manager.current = "addparticipantscreen3"

    def date_error_popup(self):
        if not self.date_error_dialog:
            self.date_error_dialog = MDDialog(
                title="Date Input Error",
                text="One or more of the dates that you entered is not in the correct format. Please change to YYYY-MM-DD.",
                buttons=[
                    MDRectangleFlatButton(
                        text="OK", on_release=self.close_date_error_dialog),
                ],
            )
        self.date_error_dialog.open()

    def close_date_error_dialog(self, *args):
        self.date_error_dialog.dismiss()
        self.manager.current = "addparticipantscreen3"

    def isp_checkbox(self):
        if self.ids.isp_checkbox.active == True:
            self.isp_yes_no = "Y"
        else:
            self.isp_yes_no = "N"

    def sdr_checkbox(self):
        if self.ids.sdr_checkbox.active == True:
            self.sdr_yes_no = "Y"
        else:
            self.sdr_yes_no = "N"

    def pcpt_checkbox(self):
        if self.ids.pcpt_checkbox.active == True:
            self.pcpt_yes_no = "Y"
        else:
            self.pcpt_yes_no = "N"

    def evv_checkbox(self):
        if self.ids.evv_checkbox.active == True:
            self.evv_yes_no = "Y"
        else:
            self.evv_yes_no = "N"

    def facesheet_checkbox(self):
        if self.ids.facesheet_checkbox.active == True:
            self.facesheet_yes_no = "Y"
        else:
            self.facesheet_yes_no = "N"

    def back_to_enter_add2(self):
        self.manager.current = "addparticipantscreen2"

    def add_participant_submit(self):
        self.isp_checkbox()
        self.sdr_checkbox()
        self.pcpt_checkbox()
        self.evv_checkbox()
        self.facesheet_checkbox()
        if self.ids.add3_participant_id.text == "" or self.ids.add_regional_supervisor.text == "" or\
            self.ids.add_referred_by.text == "" or self.ids.add_added_date == "":
                self.missing_fields_alert()
        else:
            try:
                add3_id = self.ids.add3_participant_id.text
                regional_supervisor = self.ids.add_regional_supervisor.text
                instructor1 = self.ids.add_instructor1.text
                instructor1_service = self.ids.add_instructor1_service.text
                instructor2 = self.ids.add_instructor2.text
                instructor2_service = self.ids.add_instructor2_service.text
                instructor3 = self.ids.add_instructor3.text
                instructor3_service = self.ids.add_instructor3_service.text
                isp_yn = self.isp_yes_no
                if self.ids.add_isp_date.text == "":
                    isp_date = ""
                else:
                    isp_date = datetime.strptime(self.ids.add_isp_date.text, "%Y-%m-%d")
                if self.ids.add_isp_end_date.text == "":
                    isp_end_date = ""
                else:
                    isp_end_date = datetime.strptime(self.ids.add_isp_end_date.text, "%Y-%m-%d")
                sdr_yn = self.sdr_yes_no
                if self.ids.add_sdr_date.text == "":
                    sdr_date = ""
                else:
                    sdr_date = datetime.strptime(self.ids.add_sdr_date.text, "%Y-%m-%d")
                if self.ids.add_sdr_end_date.text == "":
                    sdr_end_date = ""
                else:
                    sdr_end_date = datetime.strptime(self.ids.add_sdr_end_date.text, "%Y-%m-%d")
                pcpt_yn = self.pcpt_yes_no
                if self.ids.add_pcpt_date.text == "":
                    pcpt_date = ""
                else:
                    pcpt_date = datetime.strptime(self.ids.add_pcpt_date.text, "%Y-%m-%d")

                evv_yn = self.evv_yes_no
                facesheet_yn = self.facesheet_yes_no
                outcome1 = self.ids.add_outcome1.text
                outcome2 = self.ids.add_outcome2.text
                outcome3 = self.ids.add_outcome3.text
                outcome4 = self.ids.add_outcome4.text
                added_date = datetime.strptime(self.ids.add_added_date.text, "%Y-%m-%d")
                referred_by = self.ids.add_referred_by.text
                notes = self.ids.add_notes_text.text
                entered_by = LoginScreen.login_username
                event = "Add Participant"

    # This part will update the temporary participants table
                mydb = mysql.connector.connect(host='sql5.freemysqlhosting.net',
                                               database='sql5460613',
                                               user='sql5460613',
                                               password='')

                cursor = mydb.cursor(buffered=True)
                sql_command = "UPDATE tempparticipants SET ID = %s, regional_supervisor = %s," \
                              "instructor1 = %s, instructor1_service = %s," \
                              "instructor2 = %s, instructor2_service = %s," \
                              "instructor3 = %s, instructor3_service = %s," \
                              "isp_yes_no = %s, isp_date = %s, isp_end_date = %s," \
                              "sdr_yes_no = %s, sdr_date = %s, sdr_end_date = %s," \
                              "pcpt_yes_no = %s, pcpt_date = %s, evv_yes_no = %s, facesheet_yes_no = %s," \
                              "outcome1 = %s, outcome2 = %s, outcome3 = %s, outcome4 = %s," \
                              "added_date = %s, referred_by = %s, notes = %s, entered_by = %s, event = %s WHERE ID = %s"

                add3_edit_values = (add3_id, regional_supervisor, instructor1, instructor1_service,
                                    instructor2, instructor2_service, instructor3,
                                    instructor3_service, isp_yn, isp_date, isp_end_date,
                                    sdr_yn, sdr_date, sdr_end_date, pcpt_yn, pcpt_date,
                                    evv_yn, facesheet_yn, outcome1, outcome2, outcome3, outcome4,
                                    added_date, referred_by, notes, entered_by, event, add3_id)
                cursor.execute(sql_command, add3_edit_values)
                mydb.commit()
                cursor.close()
                mydb.close()

    #This part will copy the data from the temporary table into the log file
                mydb = mysql.connector.connect(host='sql5.freemysqlhosting.net',
                                               database='sql5460613',
                                               user='sql5460613',
                                               password='')

                cursor = mydb.cursor(buffered=True)
                query = "SELECT * from tempparticipants"
                cursor.execute(query)
                current_add_participant_id = cursor.fetchone()
                cursor.close()
                mydb.close()
                if current_add_participant_id is None:
                    self.manager.current = "addparticipantscreen3"
                else:
                    mydb = mysql.connector.connect(host='sql5.freemysqlhosting.net',
                                                   database='sql5460613',
                                                   user='sql5460613',
                                                   password='')

                    cursor = mydb.cursor(buffered=True)
                    query = "INSERT INTO participantschangelog SELECT * from tempparticipants"
                    cursor.execute(query)
                    mydb.commit()
                    cursor.close()
                    mydb.close()

    #This part will copy the data from the temporary file into the Participants Table
                    mydb = mysql.connector.connect(host='sql5.freemysqlhosting.net',
                                                   database='sql5460613',
                                                   user='sql5460613',
                                                   password='')

                    cursor = mydb.cursor(buffered=True)
                    query = "INSERT INTO participants (ID, last_name, first_name, middle_name, birth_date,\
                            gender, added_date, street_address, apt_number, city, state, zip_code, county,\
                            home_phone, cell_phone, email, support_coordinator, support_coordinator_agency,\
                            support_coordinator_address, support_coordinator_phone, support_coordinator_ext,\
                            support_coordinator_cell, support_coordinator_email, regional_supervisor, instructor1,\
                            instructor1_service, instructor2, instructor2_service, instructor3, instructor3_service,\
                            tutoring_services, cbs_services, se_services, goods_services, tutoring_hrs,\
                            tutoring_hrs_monthly, tutoring_hrs_weekly, tutoring_hrs_remain, cbs_hrs, cbs_hrs_monthly,\
                            cbs_hrs_weekly, cbs_hrs_remain, se_hrs, se_hrs_monthly, se_hrs_weekly, se_hrs_remain,\
                            goods_hrs, goods_hrs_monthly, goods_hrs_weekly, goods_hrs_remain, guardians_yes_no,\
                            guardians_doc_yes_no, guardian1, guardian1_relation, guardian1_address,\
                            guardian1_home_phone, guardian1_cell, guardian1_email, guardian2, guardian2_relation,\
                            guardian2_address, guardian2_home_phone, guardian2_cell, guardian2_email, isp_yes_no,\
                            isp_date, isp_end_date, pcpt_yes_no, pcpt_date, sdr_yes_no, sdr_date, sdr_end_date,\
                            evv_yes_no, outcome1, outcome2, outcome3, outcome4, facesheet_yes_no, referred_by,\
                            notes) SELECT ID, last_name, first_name, middle_name, birth_date,\
                            gender, added_date, street_address, apt_number, city, state, zip_code, county,\
                            home_phone, cell_phone, email, support_coordinator, support_coordinator_agency,\
                            support_coordinator_address, support_coordinator_phone, support_coordinator_ext,\
                            support_coordinator_cell, support_coordinator_email, regional_supervisor, instructor1,\
                            instructor1_service, instructor2, instructor2_service, instructor3, instructor3_service,\
                            tutoring_services, cbs_services, se_services, goods_services, tutoring_hrs,\
                            tutoring_hrs_monthly, tutoring_hrs_weekly, tutoring_hrs_remain, cbs_hrs, cbs_hrs_monthly,\
                            cbs_hrs_weekly, cbs_hrs_remain, se_hrs, se_hrs_monthly, se_hrs_weekly, se_hrs_remain,\
                            goods_hrs, goods_hrs_monthly, goods_hrs_weekly, goods_hrs_remain, guardians_yes_no,\
                            guardians_doc_yes_no, guardian1, guardian1_relation, guardian1_address,\
                            guardian1_home_phone, guardian1_cell, guardian1_email, guardian2, guardian2_relation,\
                            guardian2_address, guardian2_home_phone, guardian2_cell, guardian2_email, isp_yes_no,\
                            isp_date, isp_end_date, pcpt_yes_no, pcpt_date, sdr_yes_no, sdr_date, sdr_end_date,\
                            evv_yes_no, outcome1, outcome2, outcome3, outcome4, facesheet_yes_no, referred_by,\
                            notes FROM tempparticipants"
                    cursor.execute(query)
                    mydb.commit()
                    cursor.close()
                    mydb.close()

    #This part will delete the data in the Participants Temporary Table
                    mydb = mysql.connector.connect(host='sql5.freemysqlhosting.net',
                                                   database='sql5460613',
                                                   user='sql5460613',
                                                   password='')

                    cursor = mydb.cursor(buffered=True)
                    sql_command = "DELETE FROM tempparticipants"
                    cursor.execute(sql_command)
                    mydb.commit()
                    cursor.close()
                    mydb.close()
    #This part will clear the fields and checkboxes of all the Add Participant fields on the screen
                    self.ids.add3_participant_id.text = ""
                    self.ids.add_regional_supervisor.text = ""
                    self.ids.add_instructor1.text = ""
                    self.ids.add_instructor1_service.text = ""
                    self.ids.add_instructor2.text = ""
                    self.ids.add_instructor2_service.text = ""
                    self.ids.add_instructor3.text = ""
                    self.ids.add_instructor3_service.text = ""
                    if self.ids.isp_checkbox.active:
                        self.ids.isp_checkbox.active = False
                    self.ids.add_isp_date.text = ""
                    self.ids.add_isp_end_date.text = ""
                    if self.ids.sdr_checkbox.active:
                        self.ids.sdr_checkbox.active = False
                    self.ids.add_sdr_date.text = ""
                    self.ids.add_sdr_end_date.text = ""
                    if self.ids.pcpt_checkbox.active:
                        self.ids.pcpt_checkbox.active = False
                    self.ids.add_pcpt_date.text = ""
                    if self.ids.evv_checkbox.active:
                        self.ids.evv_checkbox.active = False
                    if self.ids.facesheet_checkbox.active:
                        self.ids.facesheet_checkbox.active = False
                    self.ids.add_outcome1.text = ""
                    self.ids.add_outcome2.text = ""
                    self.ids.add_outcome3.text = ""
                    self.ids.add_outcome4.text = ""
                    self.ids.add_added_date.text = ""
                    self.ids.add_referred_date.text = ""
                    self.ids.add_notes_text.text = ""
                    # self.manager.current = "addparticipantscreen1"

            except Exception as err:
                print(err)
                # self.date_error_popup()


FROM THE KIVY (.KV) FILE (I excluded the action bar menu from up top and just jumped down to the input fields and buttons):

<AddParticipantScreen3>:
    name: "addparticipantscreen3"
    on_enter: root.add_participantid_screen3()

    MDLabel:
        text: "Add Participants"
        pos_hint: {"center_y": 0.90}
        font_style: "H3"
        halign: "center"

    MDTextFieldRound:
        hint_text: "Search"
        icon_left: "magnify"
        font_size: 24
        pos_hint: {"center_x": 0.90, "center_y": 0.90}
        size_hint_x: 0.15
        normal_color: app.theme_cls.accent_color
        icon_right_color: app.theme_cls.primary_color
        halign: "center"

    MDFloatLayout:

        MDLabel:
            text: "Supervision/Instructors, Documentation and Additional Information"
            size_hint_x: 0.4
            font_size: 24
            halign: "center"
            pos_hint: {"center_x": 0.5, "center_y": 0.78}

        MDSeparator:
            orientation: "horizontal"
            size_hint_y: None
            size_hint_x: None
            height: dp(2)
            width: root.width
            pos_hint: {"center_x": 0.5, "center_y": 0.75}
            color: (1, 1, 1, 1)

        MDTextField:
            id: add3_participant_id
            hint_text: "DDD Number"
            font_size: 24
            mode: "rectangle"
            helper_text_mode: "persistent"
            required: True
            text_size: 18
            size_hint_x: 0.08
            multiline: False
            pos_hint: {"x": 0.01, "center_y": 0.68}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_regional_supervisor
            hint_text: "Regional Supervisor (Full Name)"
            font_size: 24
            mode: "rectangle"
            helper_text_mode: "persistent"
            required: True
            text_size: 18
            size_hint_x: 0.28
            multiline: False
            pos_hint: {"x": 0.11, "center_y": 0.68}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_instructor1
            hint_text: "Instructor 1 (Full Name)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.28
            multiline: False
            pos_hint: {"x": 0.41, "center_y": 0.68}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_instructor1_service
            hint_text: "Instructor 1 Service (Tutoring, CBS, SE, Goods)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.20
            multiline: False
            pos_hint: {"x": 0.71, "center_y": 0.68}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_instructor2
            hint_text: "Instructor 2 (Full Name)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.28
            multiline: False
            pos_hint: {"x": 0.01, "center_y": 0.58}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_instructor2_service
            hint_text: "Instructor 1 Service (Tutoring, CBS, SE, Goods)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.20
            multiline: False
            pos_hint: {"x": 0.31, "center_y": 0.58}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_instructor3
            hint_text: "Instructor 3 (Full Name)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.33
            multiline: False
            pos_hint: {"x": 0.53, "center_y": 0.58}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_instructor3_service
            hint_text: "Instructor 3 Service (Tutoring, CBS, SE, Goods)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.20
            multiline: False
            pos_hint: {"x": 0.01, "center_y": 0.48}
            halign: "left"
            write_tab: False

        MDLabel:
            text: "ISP:"
            font_size: 18
            pos_hint: {"x": 0.25, "center_y": 0.48}
        MDCheckbox:
            id: isp_checkbox
            size_hint: None, None
            size: "50dp", "50dp"
            pos_hint: {"x": 0.28, "center_y": 0.48}

        MDTextField:
            id: add_isp_date
            hint_text: "ISP Date (YYYY-MM-DD)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.10
            multiline: False
            pos_hint: {"x": 0.32, "center_y": 0.48}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_isp_end_date
            hint_text: "ISP End Date (YYYY-MM-DD)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.12
            multiline: False
            pos_hint: {"x": 0.44, "center_y": 0.48}
            halign: "left"
            write_tab: False

        MDLabel:
            text: "SDR:"
            font_size: 18
            pos_hint: {"x": 0.59, "center_y": 0.48}
        MDCheckbox:
            id: sdr_checkbox
            size_hint: None, None
            size: "50dp", "50dp"
            pos_hint: {"x": 0.61, "center_y": 0.48}

        MDTextField:
            id: add_sdr_date
            hint_text: "SDR Date (YYYY-MM-DD)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.10
            multiline: False
            pos_hint: {"x": 0.65, "center_y": 0.48}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_sdr_end_date
            hint_text: "SDR End Date (YYYY-MM-DD)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.12
            multiline: False
            pos_hint: {"x": 0.77, "center_y": 0.48}
            halign: "left"
            write_tab: False

        MDLabel:
            text: "PCPT:"
            font_size: 18
            pos_hint: {"x": 0.01, "center_y": 0.38}
        MDCheckbox:
            id: pcpt_checkbox
            size_hint: None, None
            size: "50dp", "50dp"
            pos_hint: {"x": 0.04, "center_y": 0.38}

        MDTextField:
            id: add_pcpt_date
            hint_text: "PCPT Date (YYYY-MM-DD)"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.11
            multiline: False
            pos_hint: {"x": 0.08, "center_y": 0.38}
            halign: "left"
            write_tab: False

        MDLabel:
            text: "EVV:"
            font_size: 18
            pos_hint: {"x": 0.22, "center_y": 0.38}
        MDCheckbox:
            id: evv_checkbox
            size_hint: None, None
            size: "50dp", "50dp"
            pos_hint: {"x": 0.24, "center_y": 0.38}

        MDLabel:
            text: "Facesheet:"
            font_size: 18
            pos_hint: {"x": 0.28, "center_y": 0.38}
        MDCheckbox:
            id: facesheet_checkbox
            size_hint: None, None
            size: "50dp", "50dp"
            pos_hint: {"x": 0.34, "center_y": 0.38}

        MDTextField:
            id: add_outcome1
            hint_text: "Outcome 1"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.40
            multiline: False
            pos_hint: {"x": 0.38, "center_y": 0.38}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_outcome2
            hint_text: "Outcome 2"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.40
            multiline: False
            pos_hint: {"x": 0.01, "center_y": 0.28}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_outcome3
            hint_text: "Outcome 3"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.40
            multiline: False
            pos_hint: {"x": 0.43, "center_y": 0.28}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_outcome4
            hint_text: "Outcome 4"
            font_size: 24
            mode: "rectangle"
            text_size: 18
            size_hint_x: 0.40
            multiline: False
            pos_hint: {"x": 0.01, "center_y": 0.18}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_added_date
            hint_text: "Added Date (YYYY-MM-DD)"
            font_size: 24
            mode: "rectangle"
            helper_text_mode: "persistent"
            required: True
            text_size: 18
            size_hint_x: 0.11
            multiline: False
            pos_hint: {"x": 0.50, "center_y": 0.18}
            halign: "left"
            write_tab: False

        MDTextField:
            id: add_referred_by
            hint_text: "Referred By"
            font_size: 24
            mode: "rectangle"
            helper_text_mode: "persistent"
            required: True
            text_size: 18
            size_hint_x: 0.35
            multiline: False
            pos_hint: {"x": 0.63, "center_y": 0.18}
            halign: "left"
            write_tab: False

        MDLabel:
            text: "Notes:"
            font_size: 18
            pos_hint: {"x": 0.01, "center_y": 0.08}

        ScrollView:
            id: add_notes_scrollview
            pos_hint: {"x": 0.06, "center_y": 0.08}
            size_hint: 0.40, 0.05
            TextInput:
                id: add_notes_text
                # text: ""
                multiline: True
                size_hint: 1, None
                height: max(self.minimum_height, add_notes_scrollview.height)

        MDRaisedButton:
            id: add_participant_screen3_back
            text: "Back"
            font_size: 24
            size_hint_x: 0.15
            pos_hint: {"x": 0.50, "center_y": 0.08}
            halign: "left"
            background_normal: ""
            background_color: (0, 0, 1, 1)
            on_release: root.back_to_enter_add2()

        MDRaisedButton:
            id: add_participant_screen3_submit
            text: "Submit"
            font_size: 24
            size_hint_x: 0.15
            pos_hint: {"x": 0.70, "center_y": 0.08}
            halign: "left"
            background_normal: ""
            background_color: (0, 0, 1, 1)
            on_release: root.add_participant_submit()

Elliot Garbus

unread,
Jan 13, 2022, 4:52:41 PM1/13/22
to kivy-...@googlegroups.com

I generally prefer to look at code I can run.  I will take a look.  Please also post the full traceback that shows the error.

 

On Thursday, January 13, 2022 at 2:48:39 PM UTC-5 ElliotG wrote:

That should work.  Do you have a small runnable example.  Perhaps something else is going on.

 

From: Quantumrobs
Sent: Thursday, January 13, 2022 12:34 PM
To: Kivy users support
Subject: [kivy-users] Issue clearing text from a multiline text field

 

Hello. I am trying to clear text fields before leaving a screen. I am able to clear non-multiline fields, but for some reason, I cannot clear the text in the multiline text field.

 

I am able to use the multiline text input by users for uploads to a database, as well as assign it to variables, but it will not clear using a simple self.ids.add_notes_text.text = "". (The ID of the text field is add_notes_text.)

 

Is there a different way to do it since it is a multiline text field?

 

Thanks for the assistance.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/51461ee0-64e9-492a-b539-9c5479ee7811n%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

Elliot Garbus

unread,
Jan 13, 2022, 5:03:08 PM1/13/22
to kivy-...@googlegroups.com

I suggest removing the try/except block in:

add_participant_submit(self):

 

You will get a more useful traceback.  An except clause with out a specific error being caught – can result in difficult to debug code.

 

On Thursday, January 13, 2022 at 2:48:39 PM UTC-5 ElliotG wrote:

That should work.  Do you have a small runnable example.  Perhaps something else is going on.

 

From: Quantumrobs
Sent: Thursday, January 13, 2022 12:34 PM
To: Kivy users support
Subject: [kivy-users] Issue clearing text from a multiline text field

 

Hello. I am trying to clear text fields before leaving a screen. I am able to clear non-multiline fields, but for some reason, I cannot clear the text in the multiline text field.

 

I am able to use the multiline text input by users for uploads to a database, as well as assign it to variables, but it will not clear using a simple self.ids.add_notes_text.text = "". (The ID of the text field is add_notes_text.)

 

Is there a different way to do it since it is a multiline text field?

 

Thanks for the assistance.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/51461ee0-64e9-492a-b539-9c5479ee7811n%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

Quantumrobs

unread,
Jan 13, 2022, 5:14:39 PM1/13/22
to Kivy users support
Hi Elliot,

I will do as you suggest by moving the try/except into the add_participant_submit.

However, doing the traceback for you, I noticed what the problem is and it is not the long text field. Here is the traceback:

 Traceback (most recent call last): File "kivy\properties.pyx", line 861, in kivy.properties.ObservableDict.__getattr__ KeyError: 'add_referred_date' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Robert Sucarato\AtomProjects\LESMain\lesmain-venv\lesmainapp.py", line 932, in add_participant_submit self.ids.add_referred_date.text = "" File "kivy\properties.pyx", line 864, in kivy.properties.ObservableDict.__getattr__ AttributeError: 'super' object has no attribute '__getattr__'

It is a reference error on the add_referred_BY field.text. I had it coded as add_referred_DATE.text. I am so sorry for the incorrect question, but thank you for reminding me that having the traceback when there are these issues is the best way to figure out the issue.

I do appreciate your help and will heed your advice about the repositioning of the try/except.

Thank you again.
Reply all
Reply to author
Forward
0 new messages