TypeError: unsupported operand type(s) for +=: 'method' and 'int'
<p>I want to my program to increase the pensize of Python's turtle when the Page UP key is pressed.
I tried the following:</p>

<pre><code>#!/usr/bin/env python3
import turtle
wn=turtle.Screen()
wn.title('Control using first letter of desired action')
py=turtle.Turtle()
py.color('blue')
size=1
def front():
    py.fd(90)
def back():
    py.bk(90)
def right():
    py.rt(45)
def left():
    py.lt(45)
def increasize():
    global size
    while size&gt;=1 and size&lt;=20:
        py.pensize+=1
def decreasize():
    global size
    while size&gt;=1 and size&lt;=20:
        py.pensize-=1
wn.onkey(front,'w')
wn.onkey(back,'s')
wn.onkey(right,'d')
wn.onkey(left,'a')
wn.onkey(increasize,'Prior')
wn.onkey(decreasize,'Next')
wn.listen()
wn.mainloop()
</code></pre>

<p>But it gives an error. Full traceback:</p>

<pre><code>Exception in Tkinter callback
Traceback (most recent call last):
  File "c:\program files\python3\lib\tkinter\__init__.py", line 1549, in __call__
    return self.func(*args)
  File "c:\program files\python3\lib\turtle.py", line 686, in eventfun
    fun()
  File "D:\Python\draw_straight_key.py", line 19, in increasize
    py.pensize+=1
TypeError: unsupported operand type(s) for +=: 'method' and 'int'
Exception in Tkinter callback
Traceback (most recent call last):
  File "c:\program files\python3\lib\tkinter\__init__.py", line 1549, in __call__
    return self.func(*args)
  File "c:\program files\python3\lib\turtle.py", line 686, in eventfun
    fun()
  File "D:\Python\draw_straight_key.py", line 23, in decreasize
    py.pensize-=1
TypeError: unsupported operand type(s) for -=: 'method' and 'int'
</code></pre>