Three_Series = ["3S BLACK STOCK RIMS.png"]
def SelectedCarFunction(event=None):
Model = Var2.get()
Colour = Var3.get()
Wheels = Var4.get()
The variables Model
, Colour
and Wheels
are retrieved perfectly as they should be
if Model == "3 Series" and Colour == "Black" and Wheels == "Stock":
VarSC = Three_Series[0]
print(VarSC)
I put print(VarSC)
here to test to see if it would print "3S BLACK STOCK RIMS.png"
and it did
return VarSC
VarSC = StringVar()
DisplayFrame.grid_propagate(False)
print(VarSC)
However, now when I print(VarSC)
to see if it prints the same value as be before it doesn't, instead it prints out PY_VAR9
CarImage = PhotoImage(file=VarSC)
Here I want to assign the file to VarSC
, i.e I want VarSC to equal "3S BLACK STOCK RIMS.png"
but it doesn't
CarImageLabel = Label(DisplayFrame, image=CarImage)
CarImageLabel.grid(row=0, column=0)
root.mainloop()
Here's the entire code:
Three_Series = ["3S BLACK STOCK RIMS.png"]
def SelectedCarFunction(event=None):
Model = Var2.get()
Colour = Var3.get()
Wheels = Var4.get()
if Model == "3 Series" and Colour == "Black" and Wheels == "Stock":
VarSC = Three_Series[0]
print(VarSC)
return VarSC
VarSC = StringVar()
DisplayFrame.grid_propagate(False)
print(VarSC)
CarImage = PhotoImage(file=VarSC)
CarImageLabel = Label(DisplayFrame, image=CarImage)
CarImageLabel.grid(row=0, column=0)
root.mainloop()