{"id":3739,"date":"2018-06-03T23:36:38","date_gmt":"2018-06-03T14:36:38","guid":{"rendered":"https:\/\/www.ws-meguro.com\/\/?p=3739"},"modified":"2018-06-09T10:46:23","modified_gmt":"2018-06-09T01:46:23","slug":"youtube%e3%81%a7derek%e3%81%95%e3%82%93%e3%81%ab%e3%82%88%e3%82%8bkivy-tutorial%e3%82%92%e5%ad%a6%e3%81%b6%e2%91%a1%e3%81%ae%e5%86%92%e9%a0%ad%ef%bc%8b%e6%97%a5%e6%9c%ac%e8%aa%9e%e5%af%be%e5%bf%9c","status":"publish","type":"post","link":"https:\/\/www.wsmeguro.jp\/wp\/?p=3739","title":{"rendered":"YouTube\u3067Derek\u3055\u3093\u306b\u3088\u308bKivy Tutorial\u3092\u5b66\u3076\u2461\uff08kivy.uix.widget\u307e\u3067\uff09\uff0b\u65e5\u672c\u8a9e\u5bfe\u5fdc"},"content":{"rendered":"<p>\uff12\u56de\u76ee\u306f\u3001\u3053\u3061\u3089\u3067\u3059\u3002<br \/>\n<div class=\"lyte-wrapper fourthree\" title=\"Kivy Tutorial 2\" style=\"width:480px;max-width:100%;margin:5px;\"><div class=\"lyMe\" id=\"WYL_j9PqNe3J_Cc\" itemprop=\"video\" itemscope itemtype=\"https:\/\/schema.org\/VideoObject\"><div><meta itemprop=\"thumbnailUrl\" content=\"https:\/\/i.ytimg.com\/vi\/j9PqNe3J_Cc\/hqdefault.jpg\" \/><meta itemprop=\"embedURL\" content=\"https:\/\/www.youtube.com\/embed\/j9PqNe3J_Cc\" \/><meta itemprop=\"duration\" content=\"PT20M40S\" \/><meta itemprop=\"uploadDate\" content=\"2016-10-08T11:31:52.000Z\" \/><\/div><div id=\"lyte_j9PqNe3J_Cc\" data-src=\"https:\/\/i.ytimg.com\/vi\/j9PqNe3J_Cc\/hqdefault.jpg\" class=\"pL\"><div class=\"tC\"><div class=\"tT\" itemprop=\"name\">Kivy Tutorial 2<\/div><\/div><div class=\"play\"><\/div><div class=\"ctrl\"><div class=\"Lctrl\"><\/div><div class=\"Rctrl\"><\/div><\/div><\/div><noscript><a href=\"https:\/\/youtu.be\/j9PqNe3J_Cc\" rel=\"nofollow\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.ytimg.com\/vi\/j9PqNe3J_Cc\/0.jpg\" alt=\"Kivy Tutorial 2\" width=\"480\" height=\"340\" \/><br \/>\u3053\u306e\u52d5\u753b\u3092 YouTube \u3067\u8996\u8074<\/a><\/noscript><meta itemprop=\"description\" content=\"Code &amp; Transcript : https:\/\/goo.gl\/iBjKjm Best Kivy Book : http:\/\/amzn.to\/2duPAFD Support me on Patreon : https:\/\/www.patreon.com\/derekbanas In part 2 of my Kivy tutorial series we&#039;ll explore much of what we need to know before we start making apps in the next video. We&#039;ll cover creating custom widgets, setting default attributes, and 6 layouts being : Absolute Positioning, Floating Layout, Grid Layout, Box Layout, Stack Layout, and Page Layout. If you missed any of the previous Python videos, the series starts here : https:\/\/www.youtube.com\/playlist?list=PLGLfVvz_LVvTn3cK5e6LjhgGiSeVlIRwt Thank you to Patreon supports like the following for helping me make this video https:\/\/www.facebook.com\/cottageindustriesbuild\/ @kyleaisho @thetwistedhat vjFaLk\"><\/div><\/div><div class=\"lL\" style=\"max-width:100%;width:480px;margin:5px;\"><\/div><br \/>\n\u4eca\u56de\u306f\u3001\u30e9\u30d9\u30eb\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u306a\u306e\u3067\u3001\u4eca\u306e\u3046\u3061\u306b\u65e5\u672c\u8a9e\u306b\u5bfe\u5fdc\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002 <\/p>\n<pre class=\"lang:python decode:true \" >from kivy.core.text import LabelBase, DEFAULT_FONT\r\n\r\nLabelBase.register(DEFAULT_FONT, 'any-font-name.ttf')\r\n<\/pre>\n<p>\u3053\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002\u7121\u6599\u306e\u30d5\u30a9\u30f3\u30c8\u306f\u3042\u3061\u3089\u3053\u3061\u3089\u306b\u3042\u308a\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001mac\u3067\u306f\u3053\u308c\u3067\u52d5\u304d\u307e\u3057\u305f\u304c\u3001Windows\u3067\u306f\u6587\u5b57\u30b3\u30fc\u30c9\u3092Shift-JIS\u306b\u5909\u3048\u3066\u8aad\u307f\u76f4\u3057\u3068\u304b\u3084\u3063\u3066\u306a\u3093\u3068\u304b\u8868\u793a\u3067\u304d\u307e\u3057\u305f\u3002mac\u306e\u65b9\u304c\u3059\u3093\u306a\u308a\u8868\u793a\u3067\u304d\u308b\u306a\u3093\u3066\u3001\u306a\u3093\u304b\u4e0d\u601d\u8b70\u3002<br \/>\n<!--more--><br \/>\n\u3068\u308a\u3042\u3048\u305a\u3001\u57fa\u672c\u7cfb\u306e<\/p>\n<pre class=\"lang:python decode:true \" ># -*- coding: utf-8 -*-\r\n# \u6700\u521d\u306b\u3053\u308c\u3092\u5165\u308c\u308b\u307f\u305f\u3044\u3067\u3059\u3002\r\n\r\nimport kivy\r\nkivy.require(\"1.10.0\")\r\n\r\nfrom kivy.app import App\r\nfrom kivy.uix.widget import Widget\r\nfrom kivy.core.text import LabelBase, DEFAULT_FONT\r\nfrom kivy.resources import resource_add_path\r\n# \u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\u3092\u8ffd\u52a0\r\nresource_add_path('..\/fonts')\r\n# \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d5\u30a9\u30f3\u30c8\u3092\u5909\u66f4\u3059\u308b\r\nLabelBase.register(DEFAULT_FONT, 'komorebi-gothic.ttf')\r\nclass CustomWidget(Widget):\r\n    pass\r\n\r\nclass CustomWidgetApp(App):\r\n    def build(self):\r\n        return CustomWidget()\r\n\r\nif __name__ == \"__main__\":\r\n    CustomWidgetApp().run()<\/pre>\n<p>\u305d\u308c\u3067\u6301\u3063\u3066kv\u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true \" ># You can set default attributes that are shared by\r\n# other widgets\r\n \r\n# color is RGBA as a percent of 255 and alpha\r\n# Color is the text color\r\n# background_normal and background_down are either\r\n# white with '' or can be set to a png\r\n# background_color tints whatever the background is\r\n&lt;CustButton@Button&gt;:\r\n    font_size: 32\r\n    color: 0, 0, 0, 1\r\n    size: 150, 50\r\n    #\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\u306e\u8868\u793a\u7528\u753b\u50cf\r\n    background_normal: ''\r\n    #Background image of the button used for the default graphical representation when the button is pressed.\r\n    background_down: 'red.png'\r\n    background_color: .88, .88, .88, 1\r\n \r\n# Position is x and y from the bottom left hand corner\r\n# You can define the position based on the changing\r\n# window sizes with root.x being the left most side\r\n# and root.y being the bottom\r\n&lt;CustomWidget&gt;:\r\n    CustButton:\r\n        text: \"\u672d\u5e4c\"\r\n        pos: root.x, 200\r\n    CustButton:\r\n        text: \"\u4eac\u90fd\"\r\n        pos: 200, root.y\r\n    CustButton:\r\n        text: \"\u6771\u4eac\"\r\n        pos: 200, 400<\/pre>\n<p>red.png\u306f\u3001\u3053\u308c\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/www.wsmeguro.jp\/\/wp\/wp-content\/uploads\/2018\/06\/red.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wsmeguro.jp\/\/wp\/wp-content\/uploads\/2018\/06\/red-150x150.png\" alt=\"\" width=\"150\" height=\"150\" class=\"aligncenter size-thumbnail wp-image-3743\" srcset=\"https:\/\/www.wsmeguro.jp\/wp\/wp-content\/uploads\/2018\/06\/red-150x150.png 150w, https:\/\/www.wsmeguro.jp\/wp\/wp-content\/uploads\/2018\/06\/red-100x100.png 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><br \/>\n\u7d50\u679c\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u80cc\u666f\u304c\u8d64\u304f\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u304a\u5206\u304b\u308a\u306e\u901a\u308a\u3001\u5de6\u4e0b\u304c\u57fa\u6e96\uff080,0\uff09\u306b\u306a\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/www.wsmeguro.jp\/\/wp\/wp-content\/uploads\/2018\/06\/8b83c9765018103f84eb35c65cad2583.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wsmeguro.jp\/\/wp\/wp-content\/uploads\/2018\/06\/8b83c9765018103f84eb35c65cad2583.png\" alt=\"\" width=\"800\" height=\"624\" class=\"aligncenter size-full wp-image-3740\" srcset=\"https:\/\/www.wsmeguro.jp\/wp\/wp-content\/uploads\/2018\/06\/8b83c9765018103f84eb35c65cad2583.png 800w, https:\/\/www.wsmeguro.jp\/wp\/wp-content\/uploads\/2018\/06\/8b83c9765018103f84eb35c65cad2583-300x234.png 300w, https:\/\/www.wsmeguro.jp\/wp\/wp-content\/uploads\/2018\/06\/8b83c9765018103f84eb35c65cad2583-768x599.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><br \/>\n\u3053\u306e\u65b9\u6cd5\u306f\u3001\u5ea7\u6a19\u4e0a\u306e\u4f4d\u7f6e\u3067\u6307\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u3001Window\u306e\u30b5\u30a4\u30ba\u3092\u5909\u3048\u308b\u3068\u3001\u3053\u3046\u306a\u3063\u3061\u3083\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/www.wsmeguro.jp\/\/wp\/wp-content\/uploads\/2018\/06\/022a94fd275856e02c2c2fcef5e9aa72.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wsmeguro.jp\/\/wp\/wp-content\/uploads\/2018\/06\/022a94fd275856e02c2c2fcef5e9aa72.png\" alt=\"\" width=\"450\" height=\"300\" class=\"aligncenter size-thumbnail wp-image-3748\" \/><\/a><br \/>\n\u6b21\u53f7\u306b\u7d9a\u304f\uff08\u65e5\u672c\u8a9e\u306f\u3069\u3053\u3078\u884c\u3063\u305f\uff01\u306a\u3093\u3066\u30c4\u30c3\u30b3\u30df\u306f\u306a\u3057\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uff12\u56de\u76ee\u306f\u3001\u3053\u3061\u3089\u3067\u3059\u3002 Kivy Tutorial 2\u3053\u306e\u52d5\u753b\u3092 YouTube \u3067\u8996\u8074 \u4eca\u56de\u306f\u3001\u30e9\u30d9\u30eb\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u306a\u306e\u3067\u3001\u4eca\u306e\u3046\u3061\u306b\u65e5\u672c\u8a9e\u306b\u5bfe\u5fdc\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002 from kivy.core.text import &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[526,508],"tags":[563,527,565,513,566],"class_list":["post-3739","post","type-post","status-publish","format-standard","hentry","category-python","category-508","tag-kivy","tag-python","tag-tutorial","tag-513","tag-566"],"_links":{"self":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3739","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3739"}],"version-history":[{"count":6,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3739\/revisions"}],"predecessor-version":[{"id":3751,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3739\/revisions\/3751"}],"wp:attachment":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}