我正试图在QR码的图像上写文字,但我找不到用白色写的另一种颜色的方法(这对于QR码来说是无用的).
所以这是我得到的错误页面(我也使用Django):
TypeError at /pret/qrcode/
an integer is required
Request Method: GET
Request URL: http://127.0.0.1:8000/pret/qrcode/
Django Version: 1.6.1
Exception Type: TypeError
Exception Value:
an integer is required
Exception Location: /usr/lib/python2.7/dist-packages/PIL/ImageDraw.py in _getink, line 146
Python Executable: /usr/bin/python
Python Version: 2.7.3
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/arthur/workspace/PretD/pret/views.py" in qrcodee
160. draw.text((0, 0),"This is a test",(255,255,0),font=font)
File "/usr/lib/python2.7/dist-packages/PIL/ImageDraw.py" in text
256. ink, fill = self._getink(fill)
File "/usr/lib/python2.7/dist-packages/PIL/ImageDraw.py" in _getink
146. ink = self.draw.draw_ink(ink, self.mode)
Exception …Run Code Online (Sandbox Code Playgroud)