-2
from tkinter import *
from tkinter import ttk
class Two_port_cls:

     def Two_port_fun():
            TPN_page = Tk()
            TPN_page.title("TWO PORT PARAMETER CONVERTER")
            TPN_page.geometry('500x500')
            Input_list = ['Z-PARAMETER', 'Y-PARAMETER', 'h-PARAMETER', 'ABCD-PARAMETER']
            Input_lab = Label(TPN_page, text='INPUT PARAMETR:', font=('Halvetica', 9, 'bold')).place(x=12, y=10)
            Input_list_var = IntVar(TPN_page)
            Input_box = ttk.Combobox(TPN_page, values=Input_list, state='readonly').place(x=135, y=10)
            Input_box.current(0)
            TPN_page.mainloop()
   

AttributeError: 'NoneType' object has no attribute 'current'. Why i can't access current method in Combobox? i am getting above error. Please someone help me

1 Answers1

1

It's because ttk.Combobox(TPN_page, values=Input_list, state='readonly').place(x=135, y=10) doesn't return any value. What you should do is the following:

Input_box = ttk.Combobox(TPN_page, values=Input_list, state='readonly')
Input_box.place(x=135, y=10)
Input_box.current(0)
ewokx
  • 2,204
  • 3
  • 14
  • 27