{"id":11516,"date":"2023-05-01T07:00:35","date_gmt":"2023-04-30T22:00:35","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=11516"},"modified":"2023-04-21T04:10:38","modified_gmt":"2023-04-20T19:10:38","slug":"%e9%9d%a9%e6%96%b0%e7%9a%84%e3%81%aapython%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%ef%bc%81%e9%9b%bb%e5%ad%90%e3%83%9a%e3%83%bc%e3%83%91%e3%83%bc%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=11516","title":{"rendered":"\u9769\u65b0\u7684\u306aPython\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\uff01\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092\u4f7f\u3063\u3066\u5e97\u5185\u3092\u5909\u3048\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3075\u3068\u5e74\u304c\u660e\u3051\u3066\u304b\u3089\u3059\u3067\u306b\uff12\u30f6\u6708\u304c\u7d4c\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u6c17\u304c\u3064\u304f\u77ac\u9593\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001\u5e74\u672b\u5e74\u59cb\u306b\u500b\u4eba\u7684\u306b<code>Python<\/code>\u3067\u3084\u3063\u3066\u307f\u305f\u3044\u81ea\u7531\u7814\u7a76\u304c\u3042\u308a\u3001<code>Amazon<\/code>\u3067\u3042\u308b\u3082\u306e\u3092\u8cb7\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u7d50\u5c40\u4ed5\u4e8b\u3067\u6642\u9593\u304c\u3068\u308c\u306a\u304b\u3063\u305f\u304b\u3089\u306a\u3093\u3067\u3059\u306d\u3002\ud83d\ude05<\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u306e\u30a2\u30a4\u30c7\u30a2\u306f\u4f55\u304b\u3068\u3044\u3046\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u300c\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092\u4f7f\u3063\u305f\u5024\u672d\u2728\u300d<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3068\u306f\u3001\u3042\u306e<code>Amazon Kindle<\/code>\u306b\u3082\u63a1\u7528\u3055\u308c\u3066\u3044\u308b\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\u306a\u306e\u3067\u3059\u304c\u3001\u4f55\u304c\u30b9\u30b4\u30a4\u304b\u3068\u3044\u3046\u3068\u300c<strong>\u8868\u793a\u3092\u5909\u3048\u308b\u3068\u304d\u3060\u3051\u96fb\u6c17\u3092\u4f7f\u3046<\/strong>\u300d\u3093\u3067\u3059\u306d<\/p>\n<p>\u3064\u307e\u308a\uff01<br \/>\n\u901a\u5e38\u306e\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3068\u9055\u3063\u3066\u3001\u4e00\u5ea6\u8868\u793a\u3092\u5909\u3048\u305f\u3089\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u300c\u3082\u3046\u96fb\u6c17\u4ee3\u306f\u304b\u304b\u3089\u306a\u3044\ud83d\udc4d\u300d<\/strong><\/p>\n<p>\u3068\u3044\u3046\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u3093\u3067\u3059\u3002<br \/>\n\u96fb\u6c17\u4ee3\u304c\u9ad8\u3044\u6628\u4eca\u306b\u306f\u3001\u3068\u3066\u3082\u9700\u8981\u304c\u3042\u308b\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u8cfc\u5165\u3057\u305f\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u306f\u3053\u3061\u3089\u3067\u3059\u3002\uff08\u7a0e\u8fbc 2,199\u5186\u3067\u3057\u305f\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11518\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_9.png\" alt=\"\" width=\"370\" height=\"463\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_9-240x300.png 240w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11521\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_6.png\" alt=\"\" width=\"494\" height=\"259\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_6.png 494w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_6-300x157.png 300w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/p>\n<p><a href=\"https:\/\/amzn.to\/3YUOyap\" target=\"_blank\" rel=\"noopener\">GeeekPi 2.13\u30a4\u30f3\u30c1 250&#215;122 SPI\u901a\u4fe1\u96fb\u5b50\u30da\u30fc\u30d1\u30fc \u30e2\u30b8\u30e5\u30fc\u30eb<\/a><\/p>\n<p>\u203b \u6b8b\u5ff5\u306a\u304c\u3089\u30012023.3.16\u73fe\u5728\u3067\u58f2\u308a\u5207\u308c\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u4ed6\u306b\u3082\u540c\u3058\u3088\u3046\u306a\u5546\u54c1\u304c\u3042\u308b\u307f\u305f\u3044\u3067\u3059\u3002\u305c\u3072\u63a2\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u306a\u305c\u79c1\u304c\u3053\u306e\u5546\u54c1\u3092\u8cfc\u5165\u3057\u305f\u304b\u3068\u3044\u3046\u3068\u3001\u3059\u3067\u306b\u6301\u3063\u3066\u3044\u308b<code>Raspberry Pi 3<\/code>\u306b\u63a5\u7d9a\u3067\u304d\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u300c<strong>Python + Raspberry Pi<\/strong>\u300d\u3067\u81ea\u7531\u306b\u5185\u5bb9\u3092\u5909\u66f4\u3067\u304d\u308b\u5024\u672d\u3092\u3064\u304f\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude04\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4328 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_3.png\" alt=\"\" width=\"364\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_3.png 364w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_3-300x264.png 300w\" sizes=\"auto, (max-width: 364px) 100vw, 364px\" \/>\u300c\u3061\u3087\u3063\u3068\u9ad8\u3044\u670d\u3092<br \/>\n\u901a\u884c\u4eba\u306e\u30d0\u30c3\u30af\u30d1\u30c3\u30af\u306b<br \/>\n\u5f15\u3063\u639b\u3051\u3089\u308c\u307e\u3057\u305f\u2026\u305d\u3057\u3066\u6368\u3066\u305f\ud83d\ude2b\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Raspberry Pi 3\u3001Python 3<\/p>\n<h1>Raspberry Pi \u306e SPI \u3092\u6709\u52b9\u306b\u3059\u308b<\/h1>\n<p>\u6b63\u76f4\u306a\u3068\u3053\u308d\u3001\u96fb\u5b50\u5de5\u4f5c\u306f\u30ba\u30d6\u306e\u7d20\u4eba\u306a\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3084\u3089\u8cfc\u5165\u3057\u305f\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3068<code>Raspberry Pi<\/code>\u3092\u3064\u306a\u3050\u305f\u3081\u306b\u306f<code>SPI<\/code>\u3068\u3044\u3046\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u304c\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u306e\u3053\u3068\u3067\u3001\u307e\u305a\u306f\u3053\u3053\u306e\u4f5c\u696d\u3092\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div>\n<pre><strong>sudo raspi-config<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8868\u793a\u306b\u306a\u308b\u306e\u3067\u3001\u5341\u5b57\u30ad\u30fc\u3092\u4f7f\u3063\u3066\u300c<strong>Interfacing Options<\/strong>\u300d\u3078\u79fb\u52d5\u3057\u30a8\u30f3\u30bf\u30fc\u30ad\u30fc\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11526\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_1.png\" alt=\"\" width=\"639\" height=\"375\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_1.png 639w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_1-300x176.png 300w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/p>\n<p>\u6b21\u306b\u304a\u76ee\u5f53\u3066\u306e\u300c<strong>SPI<\/strong>\u300d\u3092\u9078\u629e\uff06\u30a8\u30f3\u30bf\u30fc\u30ad\u30fc\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11525\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_2.png\" alt=\"\" width=\"640\" height=\"375\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_2.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_2-300x176.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u300c<strong>\u6709\u52b9\u306b\u3059\u308b\uff1f<\/strong>\u300d\u3068\u805e\u3044\u3066\u304f\u308b\u306e\u3067\u300c<strong>\u306f\u3044<\/strong>\u300d\u3092\u9078\u629e\uff06\u30a8\u30f3\u30bf\u30fc\u30ad\u30fc\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11524\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_3.png\" alt=\"\" width=\"638\" height=\"373\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_3.png 638w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_3-300x175.png 300w\" sizes=\"auto, (max-width: 638px) 100vw, 638px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u300c<strong>\u6709\u52b9\u306b\u306a\u3063\u305f\u3088\ud83d\udc4d<\/strong>\u300d\u3068\u8a00\u3063\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11523\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_4.png\" alt=\"\" width=\"638\" height=\"373\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_4.png 638w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_4-300x175.png 300w\" sizes=\"auto, (max-width: 638px) 100vw, 638px\" \/><\/p>\n<p>\u3053\u308c\u3067\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u306e\u4f5c\u696d\u306f\u7d42\u4e86\u3067\u3059\u3002<\/p>\n<h1>\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092Raspberry Pi \u30bb\u30c3\u30c8\u3059\u308b<\/h1>\n<p>\u6700\u521d\u307e\u3063\u305f\u304f\u3046\u307e\u304f\u3044\u304b\u306a\u304f\u3066\u7126\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u300c<strong>\u601d\u3044\u3063\u304d\u308a\u529b\u3092\u4f7f\u3063\u3066\u5dee\u3057\u8fbc\u3080\u3060\u3051<\/strong>\u300d\u3067OK\u3067\u3057\u305f\u3002\uff08\u3064\u307e\u308a\u3001\u30d3\u30d3\u30ea\u306a\u6027\u683c\u304c\u90aa\u9b54\u3092\u3057\u3066\u305f\u3093\u3067\u3059\u306d\ud83d\ude2b\uff09<\/p>\n<p>\u307e\u305a\u5dee\u3057\u8fbc\u3080\u5834\u6240\u306f<code>Raspberry Pi<\/code>\u306e\u8d64\u67a0\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11519\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_8.png\" alt=\"\" width=\"475\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_8.png 475w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_8-300x196.png 300w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092\u601d\u3044\u3063\u304d\u308a\u300c\u3076\u3063\u523a\u3057\u300d\u307e\u3059\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11520\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_7.png\" alt=\"\" width=\"478\" height=\"317\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_7.png 478w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_7-300x199.png 300w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/p>\n<p>\u203b \u3061\u306a\u307f\u306b\u30d4\u30f3\u304c\uff11\u5217\u3084\uff12\u5217\u305a\u308c\u3066\u3082\u523a\u3055\u308a\u307e\u3059\u306e\u3067\u30d4\u30c3\u30bf\u30ea\u5408\u3046\u3088\u3046\u306b\u6c17\u3092\u3064\u3051\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u308c\u3067\u30cf\u30fc\u30c9\u5074\u306e\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u2757<\/p>\n<h1>GitHub\u304b\u3089\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30af\u30ed\u30fc\u30f3\uff08\u30b3\u30d4\u30fc\uff09\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u304c<code>Python<\/code>\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u3068\u306f\u8a00\u3063\u3066\u3082\u4ee5\u4e0b\u30da\u30fc\u30b8\u306b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u3066\u3001\u3055\u3089\u306b<code>GitHub<\/code>\u306b\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u4eca\u56de\u306f\u305d\u308c\u3092\u62e1\u5f35\u3057\u3066\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b \u3061\u306a\u307f\u306b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306e\u30e9\u30a4\u30bb\u30f3\u30b9\u306f<code>GPL<\/code>\u3067\u3057\u305f\u3002<\/p>\n<p>\ud83d\udcdd \u30b5\u30f3\u30d7\u30eb\u30da\u30fc\u30b8\uff1a <a href=\"https:\/\/wiki.52pi.com\/index.php?title=EP-0133\" target=\"_blank\" rel=\"noopener\">EP-0133 &#8211; 52Pi Wiki<\/a><br \/>\n\ud83d\udcdd GitHub\uff1a\u00a0<a href=\"https:\/\/github.com\/geeekpi\/epaper.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/geeekpi\/epaper.git<\/a><\/p>\n<p>\u307e\u305a\u306f\u3001\u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u3001<code>GitHub<\/code>\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30af\u30ed\u30fc\u30f3\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>git clone https:\/\/github.com\/geeekpi\/epaper.git<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>epaper<\/code>\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h1>\u30d5\u30a9\u30f3\u30c8\u3092\u7528\u610f\u3059\u308b<\/h1>\n<p>\u6b21\u306b\u30b3\u30fc\u30c9\u306a\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u30b3\u30fc\u30c9\u3067\u306f\u30d5\u30a9\u30f3\u30c8\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u304b\u3089\u30d5\u30a9\u30f3\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\uff06\u5c55\u958b\u3057\u3001<code>epaper<\/code>\u30d5\u30a9\u30eb\u30c0\u306b\u300c<strong>ipaexg.ttf<\/strong>\u300d\u3092\u79fb\u52d5\u3055\u305b\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u7167\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/moji.or.jp\/ipafont\/ipafontdownload\/\" target=\"_blank\" rel=\"noopener\">IPA Font \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a><\/p>\n<h1>Python \u3067\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u306e\u8868\u793a\u3092\u5909\u66f4\u3059\u308b\u30b3\u30fc\u30c9\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001<code>epaper<\/code>\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306b<code>price_tag.py<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u3053\u306b\u30b3\u30fc\u30c9\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<p><strong>price_tag.py<\/strong><\/p>\n<div>\n<pre><strong>from Epaper import *<\/strong>\r\n<strong>from PIL import Image #Pillow<\/strong>\r\n\r\n<strong>import datetime<\/strong>\r\n<strong>from PIL import Image<\/strong>\r\n<strong>from PIL import ImageFont<\/strong>\r\n\r\n<strong># \u753b\u50cf<\/strong>\r\n<strong>img = Image.new(\"RGB\", (250, 128), color=\"white\")<\/strong>\r\n\r\n<strong># \u8272<\/strong>\r\n<strong>color_black = '#000000'<\/strong>\r\n<strong>color_red = '#ed1c24'<\/strong>\r\n\r\n<strong># \u65e5\u4ed8<\/strong>\r\n<strong>dt = datetime.datetime.now()<\/strong>\r\n<strong>date_text = str(dt.month) +'\u6708'+ str(dt.day) +'\u65e5\u3067\u7d42\u4e86\u3067\u3059 m_ _m' <\/strong>\r\n\r\n<strong># \u30d5\u30a9\u30f3\u30c8<\/strong>\r\n<strong>small_font = ImageFont.truetype('ipaexg.ttf', 18)<\/strong>\r\n<strong>normal_font = ImageFont.truetype('ipaexg.ttf', 24)<\/strong>\r\n<strong>large_font = ImageFont.truetype('ipaexg.ttf', 32)<\/strong>\r\n\r\n<strong># \u6587\u5b57\u306e\u63cf\u753b<\/strong>\r\n<strong>from PIL import ImageDraw<\/strong>\r\n<strong>draw = ImageDraw.Draw(img)<\/strong>\r\n<strong>draw.text((10, 10), '\u9ad8\u7d1a\u30ad\u30fc\u30dc\u30fc\u30c9\u304c\u3001', color_black, normal_font)<\/strong>\r\n<strong>draw.text((15, 55), '\u306a\u3093\u3068', color_black, small_font)<\/strong>\r\n<strong>draw.text((80, 40), '10,000\u5186!!', color_black, large_font)<\/strong>\r\n<strong>draw.text((20, 90), date_text, color_black, small_font)<\/strong>\r\n\r\n<strong># \u7dda\u306e\u63cf\u753b<\/strong>\r\n<strong>draw.line((80, 80, 230, 80), color_red, width=3)<\/strong>\r\n<strong>draw.line((0, 0, 250, 0), color_red, width=5)<\/strong>\r\n<strong>draw.line((250, 0, 250, 128), color_red, width=5)<\/strong>\r\n<strong>draw.line((0, 0, 0, 128), color_red, width=5)<\/strong>\r\n<strong>draw.line((0, 122, 250, 122), color_red, width=5)<\/strong>\r\n\r\n<strong>img = img.rotate(270, expand=True)<\/strong>\r\n\r\n<strong>img.save('price_tag.png')<\/strong>\r\n\r\n\r\n<strong># \u3053\u3053\u304b\u3089\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u306b\u63cf\u753b\r\n#\uff08https:\/\/github.com\/geeekpi\/epaper.git \u304b\u3089\u5f15\u7528\uff09<\/strong>\r\n\r\n<strong># \u30b3\u30f3\u30d5\u30a3\u30b0<\/strong>\r\n<strong>X_PIXEL = 128<\/strong>\r\n<strong>Y_PIXEL = 250<\/strong>\r\n<strong>RED_CH = True<\/strong>\r\n\r\n<strong>f = Image.open('price_tag.png')<\/strong>\r\n<strong>f = f.convert('RGB') # conversion to RGB<\/strong>\r\n<strong>data = f.load()<\/strong>\r\n\r\n<strong>rBuf = [0] * 4000<\/strong>\r\n<strong>bBuf = [0] * 4000<\/strong>\r\n\r\n<strong>for y in range(250):<\/strong>\r\n<strong>    for x in range(128):<\/strong>\r\n<strong>       # Red CH<\/strong>\r\n<strong>       if data[x,y] == (237,28,36) and RED_CH is True:<\/strong>\r\n<strong>           # This algorithm has bugs if ported according to C, the solution is referred to:https:\/\/www.taterli.com\/7450\/<\/strong>\r\n<strong>           index = int(16 * y + (15 - (x - 7) \/ 8))<\/strong>\r\n<strong>           tmp = rBuf[index]<\/strong>\r\n<strong>           rBuf[index] = tmp | (1 &lt;&lt; (x % 8))<\/strong>\r\n<strong>       # Black CH<\/strong>\r\n<strong>       elif data[x,y] == (255,255,255):<\/strong>\r\n<strong>            index = int(16 * y + (15 - (x - 7) \/ 8))<\/strong>\r\n<strong>            tmp = bBuf[index]<\/strong>\r\n<strong>            bBuf[index] = tmp | (1 &lt;&lt; (x % 8))<\/strong>\r\n\r\n<strong>e = Epaper(X_PIXEL,Y_PIXEL)<\/strong>\r\n<strong>if RED_CH is True:<\/strong>\r\n<strong>    e.flash_red(buf=rBuf)<\/strong>\r\n<strong>e.flash_black(buf=bBuf)<\/strong>\r\n<strong>e.update()<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3067\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306e\u753b\u50cf\u3092 Pil\uff08Pillow\uff09\u3067\u4f5c\u6210<\/li>\n<li>\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u306b\u305d\u306e\u5185\u5bb9\u3092\u8868\u793a<\/li>\n<\/ol>\n<p>\u3064\u307e\u308a\u3001\u753b\u50cf\u3092\u3064\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u306b\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u6c17\u3092\u3064\u3051\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304c\u300c\u8272\u300d\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u8cfc\u5165\u3057\u305f\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3067\u306f\u3001\u4ee5\u4e0b\uff13\u8272\u3057\u304b\u4f7f\u3048\u307e\u305b\u3093\u3002<\/p>\n<ul>\n<li>\u9ed2\uff1a #000000<\/li>\n<li>\u767d\uff1a #ffffff<\/li>\n<li>\u8d64\uff1a #ed1c24<\/li>\n<\/ul>\n<p>\u307e\u305f\u3001\u30d5\u30a9\u30f3\u30c8\u306b\u8d64\u8272\u3092\u4f7f\u3046\u3068\u6587\u5b57\u306e\u5468\u308a\u304c\u300c<strong>#ed1c24<\/strong>\u300d\u3067\u306f\u306a\u3044\u90e8\u5206\u304c\u3067\u304d\u3066\u3057\u307e\u3046\u3088\u3046\u3067\u3001\u305d\u3053\u306f\u9ed2\u306b\u306a\u308b\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n<p>\u3068\u306f\u3044\u3048\u3053\u308c\u3067\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude04<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u5b9f\u884c\u306f\u666e\u901a\u306b<code>Python<\/code>\u3067\u5148\u307b\u3069\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>python3 price_tag.py<\/strong><\/pre>\n<p>\u4eca\u56de\u306f\u52d5\u753b\u3092\u3054\u7528\u610f\u3057\u305f\u306e\u3067\u3069\u306e\u3088\u3046\u306b\u52d5\u304f\u304b\u306f\u4ee5\u4e0b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/div>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/JaIB_K5mrZQ\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\uff01<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude04<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u6700\u5927\u306e\u30e1\u30ea\u30c3\u30c8\u3067\u3082\u3042\u308b\u300c<strong>\u5909\u66f4\u5f8c\u306e\u96fb\u6c17\u306f\u4e0d\u8981<\/strong>\u300d\u304c\u30db\u30f3\u30c8\u304b\u3082\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092<code>Raspberry Pi<\/code>\u304b\u3089\u53d6\u308a\u5916\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11522\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_5.png\" alt=\"\" width=\"450\" height=\"270\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_5.png 450w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/python_epaper_5-300x180.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u96fb\u6c17\u3092\u4f7f\u3063\u3066\u3044\u306a\u304f\u3066\u3082\u8868\u793a\u3055\u308c\u305f\u307e\u307e\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3082\u30b3\u30fc\u30c9\u3067\u753b\u50cf\u3092\u5909\u66f4\u3059\u308c\u3070\u3001\u5024\u6bb5\u3084\u65e5\u4ed8\u3060\u3063\u3066\u7c21\u5358\u306b\u5909\u66f4\u3067\u304d\u307e\u3059\u306d\u3002<\/p>\n<p>\u3059\u3079\u3066\u6210\u529f\u3067\u3059\u3002\ud83d\ude04\ud83d\udc4d\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u3053\u306e\u9593\u30bd\u30d5\u30de\u30c3\u30d7\u3078\u884c\u3063\u305f\u969b\u3001\u3069\u3046\u3084\u3089\u5024\u672d\u304c\u3053\u306e\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092\u4f7f\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u306b\u306f\u4e3b\u8981\u306a\u5546\u54c1\u30c7\u30fc\u30bf\u3084\u5024\u6bb5\u3060\u3051\u3067\u306a\u304fQR\u30b3\u30fc\u30c9\u3082\u8868\u793a\u3057\u3066\u3044\u3066\u3001\u304a\u5ba2\u3055\u3093\u304c\u6b32\u3057\u3044\u60c5\u5831\u304c\u3088\u308a\u7c21\u5358\u306b\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u4ed6\u3001\u6765\u5ba2\u7528\u306e\u540d\u672d\u306a\u3069\u3044\u308d\u3044\u308d\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u3053\u3046\u3044\u3063\u305f\u3054\u76f8\u8ac7\u304c\u3054\u3056\u3044\u307e\u3057\u305f\u3089\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<br \/>\n\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude04<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u3044\u3064\u3082\u3068\u9055\u3063\u3066\u300c<strong>Python + Raspberry Pi<\/strong>\u300d\u3067\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3046\u3044\u3046\u5de5\u4f5c\u306f\u5927\u597d\u304d\u306a\u306e\u3067\u3059\u304c\u3001\u3044\u308d\u3044\u308d\u3068\u4ed5\u4e8b\u306b\u8ffd\u308f\u308c\u3066\u3057\u307e\u3063\u3066\u30ce\u30d3\u30ce\u30d3\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u306e\u3067\u3001\u3084\u3063\u3068\u8a18\u4e8b\u306b\u3067\u304d\u3066\u826f\u304b\u3063\u305f\u3067\u3059\u3002<\/p>\n<p>\u3082\u3057\u590f\u4f11\u307f\u3068\u304b\u3067\u3057\u305f\u3089\u3001\u304a\u5b50\u3055\u3093\u3068\u306e\u81ea\u7531\u7814\u7a76\u3068\u304b\u306b\u4f7f\u3063\u3066\u3082\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u305c\u3072\u697d\u3057\u3093\u3067\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9809 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png\" alt=\"\" width=\"370\" height=\"220\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9-300x178.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u5927\u96ea\u6d77\u306e\u30ab\u30a4\u30ca<br \/>\n\u304a\u3082\u3057\u308d\u3044\u2757\u2757\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3075\u3068\u5e74\u304c\u660e\u3051\u3066\u304b\u3089\u3059\u3067\u306b\uff12\u30f6\u6708\u304c\u7d4c\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u6c17\u304c\u3064\u304f\u77ac\u9593\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u3068\u3044\u3046\u306e\u3082\u3001\u5e74\u672b\u5e74\u59cb\u306b\u500b\u4eba\u7684\u306bPython\u3067\u3084\u3063\u3066\u307f\u305f\u3044\u81ea\u7531\u7814\u7a76\u304c\u3042\u308a\u3001A &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=11516\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u9769\u65b0\u7684\u306aPython\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\uff01\u96fb\u5b50\u30da\u30fc\u30d1\u30fc\u3092\u4f7f\u3063\u3066\u5e97\u5185\u3092\u5909\u3048\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":11534,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[238,251],"class_list":["post-11516","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-raspberry-pi","tag-251"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11516"}],"version-history":[{"count":8,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11516\/revisions"}],"predecessor-version":[{"id":11535,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11516\/revisions\/11535"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/11534"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}