I’ve managed to get my code to print out the strings below onto the console, but now I am stumped how to get each string into a label.
I want it to look like a 8 day forecast, with a column per day. Here is the code I have so far:
string = f'[{city} - 8 Days Forecast]\n'
for i in range(len(day)):
if i ==0:
string += f'\nDay {i+1} (Today \n'
elif i ==1:
string += f'\nDay {i+1} (Tomorrow \n'
else:
string += f'\nDay {i+1} \n'
string+= 'Daytime:'+ str(day[i])+ '°F'+"\n"
string+= 'Feels Like:'+ str(feelslike[i])+ '°F'+"\n"
string+= 'Night Time:'+ str(night[i])+ '°F'+"\n"
string+= 'Morning:'+ str(morn[i])+ '°F'+"\n"
string+= 'Evening:'+ str(eve[i])+ '°F'+"\n"
string+= 'Minimum:'+ str(mintemp[i])+ '°F'+"\n"
string+= 'Maximum:'+ str(maxtemp[i])+ '°F'+"\n"
string+= 'Conditions:'+ descr[i]+ "\n"
- Can I isolate each day and then add a role to that label, for each line above, e.g. this?:
if i==0:
self.label_day.text='Daytime:'+ str(day[i])+ '°F'+"\n"
-
Or, since each of the rows will be styled differently, can you add anvil-role-somecss directly to each row on the string, if so how would I format that?
-
Or, some other better way ?