0

I'm attempting to develop a registration form, but I can't get the value of the entries because nonetype and return self func are specified.

I tried entering values into the entries, but nothing worked. Again, we find that understanding some of the features and structure of your code is required before you can make modifications.

import tkinter as tk
from tkinter import *
from tkinter import ttk

class App():
    # created window
    # made all entries global
    ##################################################### ENTRIES #####################################################################

    # some entries
    def submit():
        MsgBox = messagebox.askokcancel('FYEF',"stuff",icon = 'info')
        if MsgBox == True:
            # ENTRIES
            enroll = enroll_code.get()
            readonly = readonly_combo.get()
            school = schools.get()
            sc_did = sc_id.get()
            sc_dd = sc_add.get()
            vr = vrb.get()
            if vr == 1:
                vr = 'Private'
            elif vrb == 2:
                vr = 'Public'
            PSA = PSA_no.get()
            lr_no = lr_number.get()
            last_nme = last_name.get()
            first_nme = first_name.get()
            mid_nme = mid_name.get()
            ext_nme = ext_name.get()
            birth_dte = birth_date.get()
            ageyr = age.get()
            vhr = vhar.get()
            if vhr == 1:
                vhr = 'Male'
            elif vhr == 2:
                vhr = 'Female'
            iic = ip_ic.get()
            if iic == 1:
                iic = 'Yes'
            elif iic == 2:
                iic = 'No'
            mother_ton = mother_tongue.get()
            relgaff = relg_aff.get()
            spneeds = sp_needs.get()
            eadd = em_add.get()
            hom_add = home_add.get()
            f_name = fath_name.get()
            f_contact = fath_contact.get()
            m_name = moth_name.get()
            m_contact = moth_contact.get()
            g_name = guar_name.get()
            g_contact = guar_contact.get()
            m_wifi = means_wifi.get()
            p_modal = pref_modal.get()
            concern = concerns.get()
            approve = approval.get()
            tday = date.today()
            dte = today.strftime("%B %d, %Y")

            woot = tk.Tk()
            wlc = ttk.Label(woot, text='Welcome!', font='bold, 30').place(x=50,y=100)

            
    # SUBMIT Button
    submit_button = ttk.Button(tab_2, text="Submit", command=submit).place(x=655,y=700)
App()
ehe
  • 21
  • 2
  • You dont show how the entries are made, so does this answer your question? [Tkinter: AttributeError: NoneType object has no attribute ](https://stackoverflow.com/questions/1101750/tkinter-attributeerror-nonetype-object-has-no-attribute-attribute-name) – Delrius Euphoria Jun 05 '22 at 09:35

1 Answers1

0

Edit: Asked by Delrius Euphoria. The woot = tk.Tk(), app = App(), and woot.mainloop() should be outside of class . ttk.Label should be outside of function

Try this:

import tkinter as tk
from tkinter import *
from tkinter import ttk

woot = tk.Tk()
class App():
    # created window
    # made all entries global
    ##################################################### ENTRIES #####################################################################

    # some entries
    def submit():
        MsgBox = messagebox.askokcancel('FYEF',"stuff",icon = 'info')
        if MsgBox == True:
            # ENTRIES
            enroll = enroll_code.get()
            readonly = readonly_combo.get()
            school = schools.get()
            sc_did = sc_id.get()
            sc_dd = sc_add.get()
            vr = vrb.get()
            if vr == 1:
                vr = 'Private'
            elif vrb == 2:
                vr = 'Public'
            PSA = PSA_no.get()
            lr_no = lr_number.get()
            last_nme = last_name.get()
            first_nme = first_name.get()
            mid_nme = mid_name.get()
            ext_nme = ext_name.get()
            birth_dte = birth_date.get()
            ageyr = age.get()
            vhr = vhar.get()
            if vhr == 1:
                vhr = 'Male'
            elif vhr == 2:
                vhr = 'Female'
            iic = ip_ic.get()
            if iic == 1:
                iic = 'Yes'
            elif iic == 2:
                iic = 'No'
            mother_ton = mother_tongue.get()
            relgaff = relg_aff.get()
            spneeds = sp_needs.get()
            eadd = em_add.get()
            hom_add = home_add.get()
            f_name = fath_name.get()
            f_contact = fath_contact.get()
            m_name = moth_name.get()
            m_contact = moth_contact.get()
            g_name = guar_name.get()
            g_contact = guar_contact.get()
            m_wifi = means_wifi.get()
            p_modal = pref_modal.get()
            concern = concerns.get()
            approve = approval.get()
            tday = date.today()
            dte = today.strftime("%B %d, %Y")

 
    wlc = ttk.Label(woot, text='Welcome!', font='bold, 30').place(x=50,y=100)
    enroll_code =ttk.Entry(woot).place(x=50,y=150)

    # SUBMIT Button
    submit_button = ttk.Button(woot, text="Submit", command=submit).place(x=655,y=700)
          
app = App()
woot.mainloop()
toyota Supra
  • 3,181
  • 4
  • 15
  • 19