by drjohn: n/a
You need to assess what you're trying to achieve. Unless you need to make changes to the HTML once it has been written, js can be avoided. Js is usually used for 'interactive' purposes. PHP is done and dusted by the time the page is displayed - so it is not 'interactive'. It is 'dynamic' however. It can change what HTML is passed on before page display. Based on variables/conditions, different content (via db/files/internal code) can be 'served'.
Recently, AJAX has really taken off - where php and js are combined to provide server-retrieved data without refreshing/reloading the whole page. I love it, but it can be overdone. Many think that it saves on server calls, but if not used sparingly, it can considerably increase server calls.
Personally, I use php to provide content and js to alter on-page display, e.g. sortable tables. For advice on where to use js and how to provide a working webpage for those who don't/can't have js enabled, Google "Progressive Enhancement".
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: