{"id":905,"date":"2019-04-28T17:36:16","date_gmt":"2019-04-28T08:36:16","guid":{"rendered":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/?p=905"},"modified":"2019-05-28T13:10:48","modified_gmt":"2019-05-28T04:10:48","slug":"%e6%97%a5%e6%9c%ac%e8%aa%9e-raspberry-pi%e3%81%a7%e3%83%93%e3%83%ab%e3%83%89%e3%81%97%e3%81%9fpygame%e3%81%a7%e3%83%8f%e3%83%9e%e3%81%a3%e3%81%9f%e8%a9%b1","status":"publish","type":"post","link":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/2019\/04\/28\/%e6%97%a5%e6%9c%ac%e8%aa%9e-raspberry-pi%e3%81%a7%e3%83%93%e3%83%ab%e3%83%89%e3%81%97%e3%81%9fpygame%e3%81%a7%e3%83%8f%e3%83%9e%e3%81%a3%e3%81%9f%e8%a9%b1\/","title":{"rendered":"(\u65e5\u672c\u8a9e) Raspberry Pi\u3067\u30d3\u30eb\u30c9\u3057\u305fPygame\u3067\u30cf\u30de\u3063\u305f\u8a71"},"content":{"rendered":"<div class=\"entry-content\" itemprop=\"text\">\n<p class=\"qtranxs-available-languages-message qtranxs-available-languages-message-en\">Sorry, this entry is only available in <a href=\"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp\/ja\" class=\"qtranxs-available-language-link qtranxs-available-language-link-ja\" title=\"\u65e5\u672c\u8a9e\">\u65e5\u672c\u8a9e<\/a>.<\/p>\u3042\u304f\u3042\u305f\u3093\u5728\u5ba4\u30e2\u30cb\u30bf\u30fc\u306e\u8a71\u306e\u7d9a\u304d\uff0e<\/p>\n<p>\u306a\u3093\u3068\u304b<a href=\"https:\/\/wp.me\/p6EDR2-ex\">SSL\u306ehandshake\u3067\u30a8\u30e9\u30fc\u3092\u51fa\u3055\u306a\u304f\u306a\u3063\u305f<\/a>\u306e\u3067\uff0c\u6b21\u306b\u9032\u307f\u307e\u3059\u3002<br \/>\nPython 3.7.3\u3092\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u306e\u3067\uff0cpygame\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3067\u3059\u3002<\/p>\n<pre><code>$ sudo apt install libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev\n(\u7701\u7565)\n$ sudo pip3 install pygame\n(\u7701\u7565)\nSuccessfully installed pygame-1.9.6\n<\/code><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u6b63\u5e38\u306b\u7d42\u4e86\uff0e<br \/>\n\u3042\u304f\u3042\u305f\u3093\u5728\u5ba4\u30e2\u30cb\u30bf\u30fc\u3092\u304a\u3082\u3080\u308d\u306b\u8d77\u52d5\u3057\u307e\u3059\uff0e<\/p>\n<pre><code>Fatal Python error: (pygame parachute) Segmentation Fault\n\nThread 0x71523470 (most recent call first):\n  File \"monitor.py\", line 444 in run\n  File \"\/usr\/local\/lib\/python3.6\/threading.py\", line 916 in _bootstrap_inner\n  File \"\/usr\/local\/lib\/python3.6\/threading.py\", line 884 in _bootstrap\n\nCurrent thread 0x76ccd000 (most recent call first):\n  File \"monitor.py\", line 1151 in draw_character\n  File \"monitor.py\", line 1391 in draw\n  File \"monitor.py\", line 192 in main\n  File \"monitor.py\", line 1503 in &lt;module&gt;\nAborted\n<\/code><\/pre>\n<p>\u306a\u3093\u3067\u843d\u3061\u308b\u306e\u2026\uff0e\u3057\u304b\u3082Segmentation Fault\u3068\u304b\u3001\u304a\u3088\u305dPython\u306e\u30a8\u30e9\u30fc\u3068\u306f\u601d\u3048\u306a\u3044\u3002<br \/>\n1151\u884c\u76ee\u306f\u3053\u308c\uff0e\u753b\u9762\u306b\u6587\u5b57\u30921\u6587\u5b57\u8868\u793a\u3059\u308b\u30eb\u30fc\u30c1\u30f3\uff0e<br \/>\n\u306a\u304a\uff0c\u3042\u304f\u3042\u305f\u3093\u5728\u5ba4\u30e2\u30cb\u30bf\u30fc\u3067\u306f\u753b\u9762\u4e0a\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u3067\u308b\u3068\u304d\u306b\uff0c\u6614\u306eRPG\u98a8\u306b1\u6587\u5b57\u305a\u3064\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u306f\u305d\u306e\u90e8\u5206\u3002<\/p>\n<pre><code>surf,rect = self.myfont.render(ch,self.color)\n<\/code><\/pre>\n<p>\u3044\u3084\u3044\u3084\uff0c\u4ed6\u306e\u3068\u3053\u308d\u3067\u3061\u3083\u3093\u3068\u8868\u793a\u3057\u3066\u308b\u3084\u3093\uff0e\u306a\u3093\u3067\u3053\u306e\u5834\u6240\u3060\u3051\u843d\u3061\u308b\u306e\uff0e<br \/>\n\u3053\u306e\u6587\u3092\u542b\u3080\u30e1\u30bd\u30c3\u30c9(<code>draw_character<\/code>)\u306e\u547c\u3073\u51fa\u3057\u5143\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<pre><code>self.msg_engine.draw_character(self.surface, (dx,dy), ch)\n<\/code><\/pre>\n<p>\u81f3\u3063\u3066\u666e\u901a\u3067\u7279\u306b\u554f\u984c\u304c\u898b\u53d7\u3051\u3089\u308c\u307e\u305b\u3093\u3002\u3057\u304b\u3082\uff0c\u3069\u3046\u3082\u9014\u4e2d\u307e\u3067\u306f\u8868\u793a\u3057\u3066\u308b\u307d\u3044\u306e\u3067\u3059\u3002\u306a\u3089\u3070\uff0c\u4f55\u3092\u8868\u793a\u3057\u305f\u306e\u304b\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><code>print(\"draw {},{} {} ({})\".format(dx,dy,str(ch),hex(ord(ch))))\nself.msg_engine.draw_character(self.surface, (dx,dy), ch)\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u5b9f\u884c\u3057\u305f\u3089\u3001\u3069\u3053\u306e\u6587\u5b57\u3067\u843d\u3061\u305f\u304b\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<pre><code>draw 6,6 \u3042 (0x3042)\ndraw 22,6 \u304f (0x304f)\ndraw 38,6 \u3042 (0x3042)\ndraw 54,6 \u305f (0x305f)\ndraw 70,6 \u3093 (0x3093)\ndraw 86,6 \u304c (0x304c)\ndraw 102,6 8 (0x38)\ndraw 118,6 - (0x2d)\ndraw 134,6 3 (0x33)\ndraw 150,6 2 (0x32)\ndraw 166,6 0 (0x30)\ndraw 182,6 \u3078 (0x3078)\ndraw 198,6 \u3000 (0x3000)\nFatal Python error: (pygame parachute) Segmentation Fault\n<\/code><\/pre>\n<p>\u843d\u3061\u305f\uff01\u307e\u3055\u304b\u306e\u5168\u89d2\u30b9\u30da\u30fc\u30b9\uff0e\u306a\u305c\u306a\u3093\u3060\u2026\uff0e\u305d\u306e\u5f8c\uff0c\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3067\u3082\u30c0\u30e1\u306a\u3053\u3068\u304c\u5224\u660e\u3057\u307e\u3057\u305f\u3002\u7a7a\u767d\u6587\u5b57\u5168\u822c\u304c\u30c0\u30e1\u306a\u306e\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u53ef\u8996\u6587\u5b57\u3068\u4e00\u7dd2\u306b\u30b9\u30da\u30fc\u30b9\u3092\u6df7\u305c\u305f\u5834\u5408\u306f\u304d\u3061\u3093\u3068\u52d5\u304d\u307e\u3059\u3002\u3042\u304f\u307e\u3067\u3001\u6587\u5b57\u5217\u5168\u4f53\u3067\u4f55\u3082\u63cf\u753b\u3059\u308b\u3082\u306e\u304c\u7121\u3044\u3082\u306e\u3092render\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u843d\u3061\u308b\u306e\u3067\u3059\u3002<br \/>\n\u75c7\u72b6\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u7c21\u5358\u306b\u5bfe\u8a71\u5f0f\u3067\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre><code>&gt;&gt;&gt; import pygame\npygame 1.9.6\nHello from the pygame community. https:\/\/www.pygame.org\/contribute.html\n&gt;&gt;&gt; import pygame.freetype\n&gt;&gt;&gt; pygame.freetype.init()\n&gt;&gt;&gt; from pygame.locals import *\n&gt;&gt;&gt; myfont = pygame.freetype.Font(\".\/font\/rounded-mgenplus-1cp-bold.ttf\",18)\n&gt;&gt;&gt; myfont.render(\"a\",Color(255,255,255,255))\n(&lt;Surface(9x11x32 SW)&gt;, &lt;rect(0, 10, 9, 11)&gt;)\n&gt;&gt;&gt; myfont.render(\" \",Color(255,255,255,255))\nFatal Python error: (pygame parachute) Segmentation Fault\n\nCurrent thread 0x76d49000 (most recent call first):\n  File \"&lt;stdin&gt;\", line 1 in &lt;module&gt;\nAborted\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u518d\u73fe\u3057\u307e\u3057\u305f\u3002\u534a\u89d2\u3067\u3082\u5168\u89d2\u3067\u3082\u753b\u9762\u306b\u306f\u8868\u793a\u3055\u308c\u306a\u3044\u30b9\u30da\u30fc\u30b9\u306e\u307f\u3067\u69cb\u6210\u3055\u308c\u308b\u6587\u5b57\u5217\u3092render\u3057\u3088\u3046\u3068\u3057\u305f\u3089\uff0cSegmentation Fault\u3067\u843d\u3061\u307e\u3059\u3002\u306a\u304a\uff0c\u3053\u308c\u306fRaspberry Pi\u4e0a\u306ePython 3.7.3 + pygame 1.9.6\u3067\u767a\u73fe\u3057\u305f\u306e\u3067\u3059\u304c\uff0cmacOS\u4e0a\u306ePython 3.7.3 + pygame1.9.6\u3067\u306f\u767a\u73fe\u3057\u307e\u305b\u3093\uff0e\u3069\u3046\u3044\u3046\u6a5f\u7a2e\u4f9d\u5b58\u3084\u306d\u3093\u3001\u3068\u60aa\u614b\u3092\u3064\u304d\u3064\u3064\u5bfe\u7b56\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u4ee5\u4e0a\uff0c\u306a\u305c\u304b\u3092\u8003\u3048\u3066\u3044\u3066\u3082\u57d2\u304c\u660e\u304b\u306a\u3044\u306e\u3067\uff0cwork around\u3067\u5bfe\u51e6\u3057\u307e\u3059\u3002ch\u304c\u7a7a\u767d\u6587\u5b57\u306e\u307f\u3060\u3063\u305f\u3089render\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u3061\u3083\u3048\u3070\u826f\u3044\u306e\u3067\u3059\u3002\uff08dx,dy\u306f\u4e8b\u524d\u306b\u8a08\u7b97\u3057\u3066\u4f4d\u7f6e\u6c7a\u3081\u3057\u3066\u3044\u308b\u306e\u3067\uff0c\u3053\u308c\u3067\u3082\u753b\u9762\u8868\u793a\u306f\u304f\u305a\u308c\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\uff09<\/p>\n<pre><code>if ch != \" \" and ch != \"\u3000\":\n    self.msg_engine.draw_character(self.surface, (dx,dy), ch)\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u8868\u793a\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3081\u3067\u305f\u3057\u3081\u3067\u305f\u3057\u3002\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"entry-summary\" itemprop=\"text\">\n<p>Sorry, this entry is only available in \u65e5\u672c\u8a9e.\u3042\u304f\u3042\u305f\u3093\u5728\u5ba4\u30e2\u30cb\u30bf\u30fc\u306e\u8a71\u306e\u7d9a\u304d\uff0e \u306a\u3093\u3068\u304bSSL\u306ehandshake\u3067\u30a8\u30e9\u30fc\u3092\u51fa\u3055\u306a\u304f\u306a\u3063\u305f\u306e\u3067\uff0c\u6b21\u306b\u9032\u307f\u307e\u3059\u3002 Python 3.7.3\u3092\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u306e\u3067\uff0cpygame\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3067\u3059\u3002 $ sudo apt install libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev (\u7701\u7565) $ sudo pip3 install pygame (\u7701\u7565) Successfully installed pygame-1.9.6 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u6b63\u5e38\u306b\u7d42\u4e86\uff0e \u3042\u304f\u3042\u305f\u3093\u5728\u5ba4\u30e2\u30cb\u30bf\u30fc\u3092\u304a\u3082\u3080\u308d\u306b\u8d77\u52d5\u3057\u307e\u3059\uff0e Fatal Python error: (pygame parachute) Segmentation Fault Thread 0x71523470 (most recent call first): File &#8220;monitor.py&#8221;, line 444 in run File &#8220;\/usr\/local\/lib\/python3.6\/threading.py&#8221;, line 916 in _bootstrap_inner File &#8220;\/usr\/local\/lib\/python3.6\/threading.py&#8221;, line 884 in _bootstrap Current thread 0x76ccd000 (most recent call first): File &#8220;monitor.py&#8221;, line 1151 in draw_character File &#8220;monitor.py&#8221;, line 1391 in draw File &#8220;monitor.py&#8221;, line 192 in main File &#8220;monitor.py&#8221;, line 1503 in &lt;module&gt; Aborted \u306a\u3093\u3067\u843d\u3061\u308b\u306e\u2026\uff0e\u3057\u304b\u3082Segmentation Fault\u3068\u304b\u3001\u304a\u3088\u305dPython\u306e\u30a8\u30e9\u30fc\u3068\u306f\u601d\u3048\u306a\u3044\u3002 1151\u884c\u76ee\u306f\u3053\u308c\uff0e\u753b\u9762\u306b\u6587\u5b57\u30921\u6587\u5b57\u8868\u793a\u3059\u308b\u30eb\u30fc\u30c1\u30f3\uff0e \u306a\u304a\uff0c\u3042\u304f\u3042\u305f\u3093\u5728\u5ba4\u30e2\u30cb\u30bf\u30fc\u3067\u306f\u753b\u9762\u4e0a\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u3067\u308b\u3068\u304d\u306b\uff0c\u6614\u306eRPG\u98a8\u306b1\u6587\u5b57\u305a\u3064\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u306f\u305d\u306e\u90e8\u5206\u3002 surf,rect = self.myfont.render(ch,self.color) \u3044\u3084\u3044\u3084\uff0c\u4ed6\u306e\u3068\u3053\u308d\u3067\u3061\u3083\u3093\u3068\u8868\u793a\u3057\u3066\u308b\u3084\u3093\uff0e\u306a\u3093\u3067\u3053\u306e\u5834\u6240\u3060\u3051\u843d\u3061\u308b\u306e\uff0e \u3053\u306e\u6587\u3092\u542b\u3080\u30e1\u30bd\u30c3\u30c9(draw_character)\u306e\u547c\u3073\u51fa\u3057\u5143\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002 self.msg_engine.draw_character(self.surface, (dx,dy), ch) &#8230;<\/p>\n\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[],"class_list":["post-905","post","type-post","status-publish","format-standard","hentry","category-software","entry-lead"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6EDR2-eB","_links":{"self":[{"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/posts\/905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/comments?post=905"}],"version-history":[{"count":6,"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/posts\/905\/revisions"}],"predecessor-version":[{"id":921,"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/posts\/905\/revisions\/921"}],"wp:attachment":[{"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/media?parent=905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/categories?post=905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/se.is.kit.ac.jp\/~o-mizuno\/wp-json\/wp\/v2\/tags?post=905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}