I want my user to be able to choose from 3 (or more) options. Each of these 3 options should set the var 'bg' differently.
Here's what I have so far.
bg = 'bg.png'
#bg = 'bg.png' if line2 == 1 else 'bg2.png'
if line2 == 1:
bg = 'bg.png'
if line2 == 2:
bg = 'bg2.png'
if line2 == 3:
bg = 'bg3.png'
img = Image.open(bg)
d = ImageDraw.Draw(img)
Unfortunately it doesn't work, but I hope you can see what is intended.
EDIT: I want to use the code to select an image from a TExt document. Here is the code for line2 (i.e. the 2nd line in the document):
with open("data.txt") as f:
next(f)
for line2 in f:
print("---------------")
print('Image No.:' + line2)
It prints the correct line2 number but apparently the value of 'bg' doesn't change. There is no error, but only bg.png is selected, no matter what I give as input.