{"id":22180,"date":"2014-08-11T23:01:23","date_gmt":"2014-08-11T14:01:23","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=22180"},"modified":"2014-08-11T23:01:23","modified_gmt":"2014-08-11T14:01:23","slug":"toga","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/toga\/","title":{"rendered":"OS\u30cd\u30a4\u30c6\u30a3\u30d6\u306aGUI\u304c\u69cb\u7bc9\u3067\u304d\u308bPython\u7528GUI\u30c4\u30fc\u30eb\u30ad\u30c3\u30c8\u300ctoga\u300d"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/08\/blogtoga.jpg\" alt=\"Toga\" title=\"toga.jpg\" border=\"0\" width=\"546\" height=\"210\" \/><\/p>\n<p>Python\u3092\u4f7f\u3063\u3066Mac\/Ubuntu\/Windows\/iOS\u306a\u3069\u69d8\u3005\u306a\u74b0\u5883\u3067\u52d5\u4f5c\u3059\u308bGUI\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308bGUI\u30c4\u30fc\u30eb\u30ad\u30c3\u30c8\u300c<a href=\"http:\/\/pybee.org\/toga\/\">toga<\/a>\u300d\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3044\u307e\u3059(<a href=\"https:\/\/github.com\/pybee\/toga\">GitHub<\/a>\u3001<a href=\"https:\/\/news.ycombinator.com\/item?id=8153187\">Hacker News<\/a>)\u3002<\/p>\n<p>toga\u306e\u7279\u5fb4\u306fOS\u30cd\u30a4\u30c6\u30a3\u30d6\u306aGUI\u3092\u69cb\u7bc9\u3067\u304d\u308b\u3053\u3068\u3002\u3059\u306a\u308f\u3061\u3001OS X\u3067\u306fCocoa\u3092\u3001Ubuntu\u3067\u306fGTK+\u3092\u3068\u3044\u3063\u305f\u98a8\u306bOS\u3054\u3068\u306e\u30cd\u30a4\u30c6\u30a3\u30d6\u306aGUI\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u305f\u3081\u3001\u30af\u30ed\u30b9\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3042\u308a\u304c\u3061\u306a\u898b\u305f\u76ee\u306e\u4e0d\u81ea\u7136\u3055\u304c\u306a\u3044\u3053\u3068\u304c\u58f2\u308a\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3053\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u300c<a href=\"http:\/\/pybee.org\/\">BeeWare Suite<\/a>\u300d\u3068\u547c\u3070\u308c\u308bPython\u306eIDE\u3092\u542b\u3080\u958b\u767a\u74b0\u5883\u306e\u4e00\u90e8\u306b\u542b\u307e\u308c\u3066\u3044\u3066\u3001\u30c4\u30fc\u30eb\u611f\u3067\u306e\u9023\u643a\u3082\u8003\u3048\u3089\u308c\u3066\u3044\u308b\u69d8\u5b50\u3002Python\u4f7f\u3044\u306a\u3089\u7d50\u69cb\u4fbf\u5229\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u65e9\u901fOS X\u3067\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u7248\u306e\u30c7\u30e2\u3092\u52d5\u304b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<h3>\u30c7\u30e2\uff06\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5<\/h3>\n<p>pip\u304c\u52d5\u304f\u74b0\u5883\u306a\u3089\u3070\u7c21\u5358\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\n$ pip install toga-demo\n$ toga-demo\n<\/pre>\n<p>toga-demo\u3092\u5b9f\u884c\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u753b\u9762\u304c\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/08\/blogdemo.jpg\" alt=\"Demo\" title=\"demo.jpg\" border=\"0\" width=\"546\" height=\"322\" \/><\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u30d3\u30e5\u30fc\/\u30c4\u30ea\u30fc\u30d3\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u3001\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u30c0\u30a4\u30a2\u30ed\u30b0\u304c\u8868\u793a\u3055\u308c\u308b\u3068\u3044\u3046\u7c21\u5358\u306a\u30c7\u30e2\u30a2\u30d7\u30ea\u304c\u8d77\u52d5\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>toga\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u59cb\u3081\u3088\u3046<\/h3>\n<p>\u307e\u3060\u3067\u304d\u305f\u3066\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306a\u306e\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u304c\u5145\u5b9f\u3057\u3066\u3044\u308b\u3068\u306f\u3044\u3048\u307e\u305b\u3093\u3002\u6700\u521d\u306e\u3068\u3063\u304b\u304b\u308a\u306f<a href=\"http:\/\/toga.readthedocs.org\/en\/latest\/\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306b\u3042\u305f\u308b\u3057\u304b\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7279\u306b\u300c<a href=\"http:\/\/toga.readthedocs.org\/en\/latest\/introduction\/tutorial-0.html\">Your first Toga app<\/a>\u300d\u306b\u306f\u30c7\u30e2\u30a2\u30d7\u30ea\u3088\u308a\u3055\u3089\u306b\u7c21\u5358\u306a\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u53c2\u8003\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"python\">from __future__ import print_function, unicode_literals, absolute_import\n\nimport toga\n\ndef button_handler(widget):\n    print(\"hello\")\n\nif __name__ == '__main__':\n\n    app = toga.App('First App', 'org.pybee.helloworld')\n\n    container = toga.Container()\n\n    button = toga.Button('Hello world', on_press=button_handler)\n\n    container.add(button)\n\n    container.constrain(button.TOP == container.TOP + 50)\n    container.constrain(button.LEADING == container.LEADING + 50)\n    container.constrain(button.TRAILING + 50 == container.TRAILING)\n    container.constrain(button.BOTTOM + 50 < container.BOTTOM)\n\n    app.main_window.content = container\n\n    app.main_loop()\n<\/code><\/pre>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u7d4c\u9a13\u8005\u306a\u3089\u3070\u306a\u3093\u3068\u306a\u304f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u610f\u5473\u306f\u5206\u304b\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u516c\u5f0f\u30b5\u30a4\u30c8\u306b\u89e3\u8aac\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u8a73\u3057\u304f\u306f\u305d\u3061\u3089\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u3092\u4f8b\u3048\u3070hello.py\u3068\u540d\u524d\u3092\u4ed8\u3051\u3066\u4fdd\u5b58\u3057\u3001python hello.py\u3068\u5b9f\u884c\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/08\/blogFirst-App.jpg\" alt=\"First App\" title=\"First App.jpg\" border=\"0\" width=\"546\" height=\"409\" \/><\/p>\n<p>\u30dc\u30bf\u30f3\u3092\u62bc\u305b\u3070\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u300chello\u300d\u3068\u8868\u793a\u3055\u308c\u308b\u8d85\u57fa\u672c\u7684\u306a\u30a2\u30d7\u30ea\u3067\u3059\u3002<\/p>\n<h3>\u767a\u5c55\u3059\u308c\u3070\u4fbf\u5229\u306b\u306a\u308b\u304b\u3082<\/h3>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u7528\u306eGUI\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u610f\u5916\u3068\u305f\u304f\u3055\u3093\u5b58\u5728\u3057\u3066\u3044\u3066\u3001\u4f8b\u3048\u3070Python\u7528\u306e\u3082\u306e\u3068\u3057\u3066\u306f<a href=\"http:\/\/www.wxpython.org\/\">wxPython<\/a>\u306a\u3093\u3066\u3082\u306e\u6709\u540d\u3067\u3059\u3002toga\u304c\u3053\u308c\u3089\u3068\u6bd4\u8f03\u3057\u3066\u3069\u306e\u3088\u3046\u306a\u5229\u70b9\u304c\u3042\u308b\u306e\u304b\u5c11\u3057\u89e6\u3063\u305f\u3050\u3089\u3044\u3060\u3068\u5224\u5225\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u624b\u8efd\u306bGUI\u30a2\u30d7\u30ea\u304c\u69cb\u7bc9\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308b\u3053\u3068\u306f\u78ba\u304b\u306a\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u73fe\u6bb5\u968e\u3060\u3068\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u304c\u7a7a\u3063\u307d\u306e\u3068\u3053\u308d\u304c\u3042\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3001\u4eca\u5f8c\u306e\u767a\u5c55\u306b\u671f\u5f85\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u3092\u4f7f\u3063\u3066Mac\/Ubuntu\/Windows\/iOS\u306a\u3069\u69d8\u3005\u306a\u74b0\u5883\u3067\u52d5\u4f5c\u3059\u308bGUI\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308bGUI\u30c4\u30fc\u30eb\u30ad\u30c3\u30c8\u300ctoga\u300d\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3044\u307e\u3059(GitHub\u3001Hacker News)\u3002 t [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":22177,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[4,75],"tags":[2610,8,703,465],"class_list":["post-22180","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mac","category-software","tag-gui","tag-osx","tag-python","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/22180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=22180"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/22180\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/22177"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=22180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=22180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=22180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}