Wednesday, September 21, 2016

Variable Pickers

Today I created functions to allow the user to select a font or colour from a list (based of the HTML/ CSS variables) which python will late insert into the html / css file. There was a small hiccup around getting the function to return the altered variable which I documented as the following:
#21-09-2016 #Error Log The font selection function should list of a number of fonts for the user to choose from, then return the choosen font as a variable set when calling the function. However when the function returns the variable it is not changed from what was originially choosen. This was solved by explicitly re-assigning the variable. So rather than creating the variable 'afont' and then using it to call the function I set it to now equal the changed variable in the function so from: afont = "blank" font_picker(afont) to: afont = "blank" afont = font_picker(afont) which reassigned the variable as initially desired.


They both also have to convert variables from a string to an integer (the answer variable after listing).