Hey, In my tkinter program i want to create a combobox and based on 1st combobox input 2nd combo box value will display. I think to do this I need to in reload combobox I don't have any idea how to do that. Can you please help me
Below my code
What I have tried:
import tkinter
import os
from tkinter import ttk
from tkinter import *
from data.binding import *
frame3=Tk()
Label(frame3,text="Shop Name").place(x=100,y=50)
shop_name=[]
pn=[]
addd=[]
myVar=StringVar()
if os.path.isfile("C:\\Dragon\dealer.txt"):
with open ("C:\\Dragon\dealer.txt") as sn:
for line in sn:
if line.split(";")[0] not in shop_name:
shop_name.append(line.split(';')[0].strip())
shopauto=ttk.Combobox(frame3,values=shop_name,width=30)
shopauto.bind("<<ComboboxSelected>>",select(pn,addd,myVar))
shopauto.place(x=230,y=50)
Label(frame3,text="Proprietor Name").place(x=100,y=90)
proname=ttk.Combobox(frame3,values=pn)
proname.place(x=230,y=90)
frame3.mainloop()
#############################################
import os
def select(pn,addd,myVar):
if os.path.isfile("C:\\Dragon\dealer.txt"):
with open("C:\\Dragon\dealer.txt") as p:
for line in p:
if myVar.get() == line.split(';')[0].strip():
pn.append(line.split(';')[1].strip())
addd.append(line.split(';')[2].strip())