Why doesn't this monkey patch work for python turtle?
问题 So I'm trying to monkey patch the onkey function in turtle so it calls a function with the button hit instead of just calling it with no arguments. I'm using the string "tester" to see if it works, but it looks like the original functions never got changes. Can someone explain what I'm doing wrong? from threading import Thread from time import sleep from turtle import * def NEWonkeypress(self, fun, key=None): if fun is None: if key in self._keys: self._keys.remove(key) elif key is not None