{"id":1175,"date":"2020-04-28T00:00:00","date_gmt":"2020-04-27T15:00:00","guid":{"rendered":"https:\/\/www.ishikawasekkei.com\/?p=1175"},"modified":"2020-05-02T14:50:28","modified_gmt":"2020-05-02T05:50:28","slug":"python-tkinter-gui-programing-display-dataframe","status":"publish","type":"post","link":"https:\/\/www.ishikawasekkei.com\/index.php\/2020\/04\/28\/python-tkinter-gui-programing-display-dataframe\/","title":{"rendered":"Python tkinter GUI \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 DataFrame\u3092\u8868\u793a"},"content":{"rendered":"\n<p>\u3000\u4eca\u65e5\u3082\u898b\u306b\u6765\u3066\u304f\u3060\u3055\u3063\u3066\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u77f3\u5ddd\u3055\u3093\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u3053\u306e\u3068\u3053\u308d\u3001\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u5165\u9580\u306e\u52c9\u5f37\u4e2d\u3067\u3059\u3002\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u3067\u5229\u7528\u3055\u308c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u306epandas\u306b\u3042\u308bDataFrame\u30af\u30e9\u30b9\u3001\u30c7\u30fc\u30bf\u3092\u64cd\u4f5c\u3059\u308b\u306e\u306b\u3044\u308d\u3044\u308d\u306a\u6a5f\u80fd\u304c\u3042\u3063\u3066\u3001\u3068\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002\u307c\u304f\u306f\u666e\u6bb5SQL\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u5fc5\u8981\u6027\u306f\u307e\u3063\u305f\u304f\u306a\u3044\u306e\u3067\u3059\u3051\u3069\u3001Python\u3067\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3059\u308b\u306e\u306b\u3001\u899a\u3048\u3066\u304a\u304f\u3068\u3088\u3044\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p>\u3000tkinter\u3082\u6700\u8fd1\u306e\u5b66\u7fd2\u30c6\u30fc\u30de\u306a\u306e\u3067\u3001\u7d44\u307f\u5408\u308f\u305b\u3066\u3001DataFrame\u306e\u5185\u5bb9\u3092tkinter\u3092\u4f7f\u3063\u3066\u8868\u793a\u3059\u308b\u306b\u306f\u3069\u3046\u3057\u305f\u3089\u3044\u3044\u306e\u304b\u306a\u3001\u3068\u3001\u3061\u3087\u3063\u3068\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u3067\u304d\u3042\u304c\u308a\u30a4\u30e1\u30fc\u30b8<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"162\" src=\"https:\/\/www.ishikawasekkei.com\/wp-content\/uploads\/2020\/04\/image-40.png\" alt=\"\" class=\"wp-image-1176\" srcset=\"https:\/\/www.ishikawasekkei.com\/wp-content\/uploads\/2020\/04\/image-40.png 932w, https:\/\/www.ishikawasekkei.com\/wp-content\/uploads\/2020\/04\/image-40-300x52.png 300w, https:\/\/www.ishikawasekkei.com\/wp-content\/uploads\/2020\/04\/image-40-768x133.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption>\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306e\u5185\u5bb9\u3092\u8868\u793a\u3059\u308b<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import tkinter as tk\nimport numpy as np\nfrom pandas import DataFrame\n\nclass App(tk.Tk):\n    def __init__(self):\n        super().__init__()\n        self.title(\"Display DataFrame\")\n        \n        self.df = DataFrame(np.arange(20).reshape(4,5))\n        for r in range(4):\n            for c in range(5):\n                e = tk.Entry(self)\n                e.insert(0,self.df.iloc[r,c])\n                e.grid(row=r,column=c)\n                e.bind(\"&lt;KeyPress>\",lambda event, row=r, column=c: self.change(event,row,column))\n\n    def change(self,event,row,column):\n        value = event.widget.get()\n        self.df.iloc[row,column] = value\n        print(self.df)\n\nif __name__ == '__main__':\n    app = App()\n    app.mainloop()\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u8aac\u660e<\/h2>\n\n\n\n<p>\u3000\u307e\u305a\u306f\u300110\u884c\u76ee\u3067DataFrame\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u30c7\u30fc\u30bf\u306f\u3001numpy\u306earange()\u3092\u4f7f\u3063\u3066\u30010\u304b\u308920\u500b\u306e\u8981\u7d20\u3092\u3064\u304f\u3063\u3066\u3001reshape()\u30674\u884c5\u5217\u306b\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000for\u30eb\u30fc\u30d7\u3092\u4e8c\u91cd\u306b\u3057\u3066Entry\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u4f5c\u6210\u3059\u308b\u3054\u3068\u306b\u3001insert()\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u30bb\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306f\u3001iloc[r,c]\u3092\u4f7f\u3044\u307e\u3059\u3002grid\u3067\u884c\u3068\u5217\u3092\u6307\u5b9a\u3057\u3066\u914d\u7f6e\u3057\u307e\u3059\u3002bind()\u3067&lt;KeyPress&gt;\u30a4\u30d9\u30f3\u30c8\u3001\u30ad\u30fc\u304c\u62bc\u3055\u308c\u305f\u3068\u304d\u306bchange()\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u30d0\u30a4\u30f3\u30c9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u3000\u8868\u3092\u3064\u304f\u3063\u3066\u8868\u793a\u3059\u308b\u3060\u3051\u306a\u3089\u3001\u307b\u3093\u306e\u6570\u884c\u3067\u3067\u304d\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002Python\u3063\u3066\u3001\u3059\u3054\u3044\u3067\u3059\u306d\u3047\u266a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u4eca\u65e5\u3082\u898b\u306b\u6765\u3066\u304f\u3060\u3055\u3063\u3066\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u77f3\u5ddd\u3055\u3093\u3067\u3059\u3002 \u3000\u3053\u3053\u306e\u3068\u3053\u308d\u3001\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u5165\u9580\u306e\u52c9\u5f37\u4e2d\u3067\u3059\u3002\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u3067\u5229\u7528\u3055\u308c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u306epandas\u306b\u3042\u308bDataFrame\u30af\u30e9\u30b9\u3001\u30c7\u30fc\u30bf\u3092\u64cd\u4f5c\u3059\u308b\u306e\u306b &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.ishikawasekkei.com\/index.php\/2020\/04\/28\/python-tkinter-gui-programing-display-dataframe\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Python tkinter GUI \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 DataFrame\u3092\u8868\u793a&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,13,2],"tags":[],"class_list":["post-1175","post","type-post","status-publish","format-standard","hentry","category-program","category-tkinter","category-blog"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts\/1175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/comments?post=1175"}],"version-history":[{"count":3,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts\/1175\/revisions"}],"predecessor-version":[{"id":1202,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts\/1175\/revisions\/1202"}],"wp:attachment":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/media?parent=1175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/categories?post=1175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/tags?post=1175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}