{"id":4489,"date":"2023-08-10T12:42:12","date_gmt":"2023-08-10T12:42:12","guid":{"rendered":"https:\/\/rengga.dev\/blog\/?p=4489"},"modified":"2023-08-28T23:49:22","modified_gmt":"2023-08-28T23:49:22","slug":"create-a-qr-code-generator-with-python","status":"publish","type":"post","link":"https:\/\/rengga.dev\/blog\/create-a-qr-code-generator-with-python\/","title":{"rendered":"Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210"},"content":{"rendered":"<p data-sourcepos=\"1:1-2:33\">Python\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u3057\u3066\u306e\u4e3b\u306a\u7279\u5fb4\u306f\u3001\u5c11\u306a\u3044\u30b3\u30fc\u30c9\u3067\u7c21\u6f54\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3051\u308b\u3053\u3068\u3001\u5c02\u9580\u7684\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u8c4a\u5bcc\u306b\u3042\u308b\u3053\u3068\u306a\u3069\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n<p data-sourcepos=\"1:1-2:33\">python\u3067QR\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u88fd\u9020\u3057\u307e\u3057\u305f\u3002\u8a18\u9332\u3068\u3057\u3066\u6295\u7a3f\u3057\u307e\u3059\u3002<!--more--><\/p>\n<p data-sourcepos=\"4:1-5:131\">\u4ee5\u4e0b\u304c\u88fd\u9020\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u753b\u50cf\u3067\u3059\u3002<\/p>\n<figure id=\"attachment_4491\" aria-describedby=\"caption-attachment-4491\" style=\"width: 452px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4491 size-full\" src=\"https:\/\/rengga.dev\/blog\/wp-content\/uploads\/2023\/06\/Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210.jpg\" alt=\"Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210\" width=\"452\" height=\"213\" \/><figcaption id=\"caption-attachment-4491\" class=\"wp-caption-text\">Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210<\/figcaption><\/figure>\n<h2 data-sourcepos=\"7:1-7:15\">\u6a5f\u80fd\u8aac\u660e<\/h2>\n<p data-sourcepos=\"9:1-11:121\">URL\u3092\u5165\u529b\u3059\u308b\u3002<br \/>\nQR\u30b3\u30fc\u30c9\u306e\u540d\u524d\u3092\u5165\u529b\u3059\u308b\u3002<br \/>\nQR\u30b3\u30fc\u30c9\u751f\u6210\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068QRname\u3067\u5165\u529b\u3057\u305f\u6587\u5b57\u3067QR\u30b3\u30fc\u30c9\u304c\u753b\u50cf\u3067\u751f\u6210\u3055\u308c\u308b\u3002<\/p>\n<h2 data-sourcepos=\"13:1-13:27\">\u30d7\u30ed\u30b0\u30e9\u30e0\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import qrcode\r\nimport tkinter\r\n\r\ndef btn_click():\r\n    S = txt_1.get()\r\n    qr_name = txt_2.get()\r\n    img = qrcode.make(S)\r\n    img.save(f'{qr_name}.png')\r\n\r\n# \u753b\u9762\u4f5c\u6210\r\ntki = tkinter.Tk()\r\ntki.geometry('460x190')\r\ntki.title('QR\u30b3\u30fc\u30c9\u4f5c\u6210')\r\ntki.configure(bg='SpringGreen2')\r\n\r\nlbl_1 = tkinter.Label(text='URL')\r\nlbl_1.place(x=70, y=50)\r\n\r\nlbl_1 = tkinter.Label(text='QRname')\r\nlbl_1.place(x=70, y=100)\r\n\r\ntxt_1 = tkinter.Entry(width=30)\r\ntxt_1.place(x=130, y=50)\r\n\r\ntxt_2 = tkinter.Entry(width=30)\r\ntxt_2.place(x=130, y=100)\r\n\r\n# \u30dc\u30bf\u30f3\r\nbtn = tkinter.Button(tki, text='QR\u30b3\u30fc\u30c9\u751f\u6210', command=btn_click)\r\nbtn.place(x=180, y=150)\r\ntki.mainloop() # \u30a2\u30d7\u30ea\u3092\u8d77\u52d5<\/pre>\n<p>\u5b9f\u969b\u306b\u4f5c\u6210\u3057\u305fQR\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<figure id=\"attachment_4490\" aria-describedby=\"caption-attachment-4490\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4490 size-full\" src=\"https:\/\/rengga.dev\/blog\/wp-content\/uploads\/2023\/06\/Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210.png\" alt=\"Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210\" width=\"300\" height=\"300\" srcset=\"https:\/\/rengga.dev\/blog\/wp-content\/uploads\/2023\/06\/Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210.png 300w, https:\/\/rengga.dev\/blog\/wp-content\/uploads\/2023\/06\/Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210-150x150.png 150w, https:\/\/rengga.dev\/blog\/wp-content\/uploads\/2023\/06\/Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210-90x90.png 90w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-4490\" class=\"wp-caption-text\">Python\u3067QR\u30b3\u30fc\u30c9\u751f\u6210\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210<\/figcaption><\/figure>\n<p>\u662f\u975e\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff01\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u3057\u3066\u306e\u4e3b\u306a\u7279\u5fb4\u306f\u3001\u5c11\u306a\u3044\u30b3\u30fc\u30c9\u3067\u7c21\u6f54\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3051\u308b\u3053\u3068\u3001\u5c02\u9580\u7684\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u8c4a\u5bcc\u306b\u3042\u308b\u3053\u3068\u306a\u3069\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002 python\u3067QR\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u88fd\u9020\u3057\u307e\u3057\u305f\u3002\u8a18\u9332\u3068\u3057\u3066\u6295\u7a3f\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":4492,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106,12],"tags":[622,625,626,623,624],"newstopic":[583],"class_list":{"0":"post-4489","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-phyton","8":"category-web-development","9":"tag-python","10":"tag-python-app","11":"tag-python-qr-code","12":"tag-python-tips","13":"tag-python-tricks","14":"newstopic-phyton"},"_links":{"self":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/4489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/comments?post=4489"}],"version-history":[{"count":2,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/4489\/revisions"}],"predecessor-version":[{"id":4494,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/4489\/revisions\/4494"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/media\/4492"}],"wp:attachment":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/media?parent=4489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/categories?post=4489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/tags?post=4489"},{"taxonomy":"newstopic","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/newstopic?post=4489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}