0
pen.write('Player A:', str(score_a),  'Player B:', str(score_b), align='center', font=('Courier', 24, 'normal'))

(turtle imported)
(score_a and score_b are variables that contain a boolean)
This happened right after I added str(score_a) and str(score_b). Why is it like that and how can i fix it?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578

1 Answers1

0

You're assuming that turtle write() works like Python print(), it doesn't. It only takes one thing to write, not multiple. You can try:

pen.write('Player A: ' + str(score_a) + ' Player B: ' + str(score_b), align='center', font=('Courier', 24, 'normal'))

or:

pen.write('Player A: {}  Player B: {}'.format(score_a, score_b), align='center', font=('Courier', 24, 'normal'))

Or whatever approach you prefer to generate a single item to write.

cdlane
  • 40,441
  • 5
  • 32
  • 81