Project Administration
When a complex project is completed like the editable list of numbers, the programmer might want to benefit from their efforts. Copyright gives the programmer legal protection from unscrupulous individuals or corporations using a programmers work without compensation. The add_author function allows the programmer to put their name on the copyright notice on the bottom of the project. Update year makes the Copyright notice use the current year rather than the year that GUI4sher was written.
Sometimes a programmer will want to acknowledge help from someone but not give them ownership. The programmer can acknowledge helpers with the add_thanks function.
When a widget function is complex it can be difficult to debug. You can use the say function to write messages to the shell screen, so you can see whether the right lines are executing and what the values of variables are. In the example below there are several errors:
Below we see that there is a name error on the last line, circle is spelled wrong. Once we fix that we can see that the code won’t change the fill from the empty (unfilled). If we fix that:
At this point the project detected the misspelling in the clicks file. Once it is fixed:
The output to the shell shows that the project is working correctly. The last step is to comment out the debugging code:
def change_button_click():
#say('Circle has fill: '+color_circle.get_fill())
if color_circle.get_fill() == '':
color_circle.set_fill('green')
elif color_circle.get_fill() == 'green':
color_circle.set_fill('blue')
elif color_circle.get_fill() =='Blue':
color_circle.set_fill('red')
else: color_circle.set_fill('')
If further debugging needs to be done you can remove the # and the debugging helper statement is still there.
Contents