{"id":802,"date":"2023-04-13T13:36:03","date_gmt":"2023-04-13T04:36:03","guid":{"rendered":"https:\/\/bocek.co.jp\/media\/?p=802"},"modified":"2023-04-29T20:12:45","modified_gmt":"2023-04-29T11:12:45","slug":"%e3%80%90chatgpt%e3%80%91%e7%94%bb%e5%83%8f%e3%83%93%e3%83%a5%e3%83%bc%e3%83%af%e3%81%aepython%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e3%82%92%e4%bd%9c%e3%82%8b","status":"publish","type":"post","link":"https:\/\/taskhub.jp\/magazine\/formula\/development\/802\/","title":{"rendered":"\u3010ChatGPT\u3011\u753b\u50cf\u30d3\u30e5\u30fc\u30ef\u306ePython\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b"},"content":{"rendered":"\n<p>\u4eca\u56de\u306fChatGPT\u3092\u5229\u7528\u3057\u3066\u3001\u753b\u50cf\u30d3\u30e5\u30fc\u30ef\u306ePython\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>ChatGPT\u3092\u5229\u7528\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308c\u3070\u3001\u7d20\u65e9\u304f\u7c21\u5358\u306b\u6b32\u3057\u3044\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001\u6a5f\u80fd\u3092\u63d0\u6848\u3057\u3066\u3082\u3089\u3063\u305f\u308a\u3057\u306a\u304c\u3089\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u305a\u306f\u7c21\u5358\u306b\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u6295\u3052\u3066\u307f\u308b<\/h2>\n\n\n\n<p>\u30b7\u30f3\u30d7\u30eb\u306b\u300c\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u753b\u50cf\u30d3\u30e5\u30fc\u30ef\u306ePython\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b\u300d\u3088\u3046\u306b\u304a\u9858\u3044\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-15-1024x684.png\" alt=\"\" class=\"wp-image-804\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u51fa\u529b\u3055\u308c\u305f\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog\nfrom PIL import Image, ImageTk\n\nclass ImageViewer(tk.Tk):\n    def __init__(self):\n        super().__init__()\n\n        self.title(\"Image Viewer\")\n        self.geometry(\"800x600\")\n        \n        self.current_image_index = 0\n        self.images = &#91;]\n\n        self.label = tk.Label(self)\n        self.label.pack()\n\n        self.open_folder_button = tk.Button(self, text=\"Open Folder\", command=self.open_folder)\n        self.open_folder_button.pack()\n\n        self.prev_button = tk.Button(self, text=\"Previous\", command=self.show_previous)\n        self.prev_button.pack(side=tk.LEFT)\n\n        self.next_button = tk.Button(self, text=\"Next\", command=self.show_next)\n        self.next_button.pack(side=tk.RIGHT)\n\n    def open_folder(self):\n        folder_path = filedialog.askdirectory()\n        if folder_path:\n            self.images = &#91;\n                os.path.join(folder_path, file) for file in os.listdir(folder_path)\n                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))\n            ]\n            self.current_image_index = 0\n            self.show_current_image()\n\n    def show_current_image(self):\n        if self.images:\n            image_path = self.images&#91;self.current_image_index]\n            image = Image.open(image_path)\n            image.thumbnail((800, 600), Image.ANTIALIAS)\n            photo = ImageTk.PhotoImage(image)\n            self.label.config(image=photo)\n            self.label.image = photo\n\n    def show_previous(self):\n        if self.images:\n            self.current_image_index -= 1\n            if self.current_image_index &lt; 0:\n                self.current_image_index = len(self.images) - 1\n            self.show_current_image()\n\n    def show_next(self):\n        if self.images:\n            self.current_image_index += 1\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index = 0\n            self.show_current_image()\n\nif __name__ == \"__main__\":\n    viewer = ImageViewer()\n    viewer.mainloop()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-16.png\" alt=\"\" class=\"wp-image-808\"\/><figcaption class=\"wp-element-caption\">\u3053\u306e\u3088\u3046\u306b\u3001\u7c21\u5358\u306a\u6307\u793a\u3067\u753b\u50cf\u30d3\u30e5\u30fc\u30ef\u3092\u4f5c\u308b\u3053\u3068\u3067\u304d\u307e\u3057\u305f\u3002<\/figcaption><\/figure>\n\n\n\n<p>\u300cPrevious\u300d\u300cNext\u300d\u3067\u753b\u50cf\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6a5f\u80fd\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n\n\n\n<p>\u4e00\u6c17\u306b10\u679a\u305a\u3064\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u304a\u9858\u3044\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-19.png\" alt=\"\" class=\"wp-image-813\" width=\"770\" height=\"278\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u51fa\u529b\u3055\u308c\u305f\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog\nfrom PIL import Image, ImageTk\n\nclass ImageViewer(tk.Tk):\n    def __init__(self):\n        super().__init__()\n\n        self.title(\"Image Viewer\")\n        self.geometry(\"1600x1200\")\n\n        self.current_image_index = 0\n        self.images = &#91;]\n\n        self.labels = &#91;]\n        for i in range(2):\n            for j in range(5):\n                label = tk.Label(self)\n                label.grid(row=i, column=j)\n                self.labels.append(label)\n\n        self.open_folder_button = tk.Button(self, text=\"Open Folder\", command=self.open_folder)\n        self.open_folder_button.grid(row=2, column=2)\n\n        self.prev_button = tk.Button(self, text=\"Previous\", command=self.show_previous)\n        self.prev_button.grid(row=3, column=0)\n\n        self.next_button = tk.Button(self, text=\"Next\", command=self.show_next)\n        self.next_button.grid(row=3, column=4)\n\n    def open_folder(self):\n        folder_path = filedialog.askdirectory()\n        if folder_path:\n            self.images = &#91;\n                os.path.join(folder_path, file) for file in os.listdir(folder_path)\n                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))\n            ]\n            self.current_image_index = 0\n            self.show_current_images()\n\n    def show_current_images(self):\n        for i, label in enumerate(self.labels):\n            image_index = self.current_image_index + i\n            if image_index &lt; len(self.images):\n                image_path = self.images&#91;image_index]\n                image = Image.open(image_path)\n                image.thumbnail((300, 300), Image.ANTIALIAS)\n                photo = ImageTk.PhotoImage(image)\n                label.config(image=photo)\n                label.image = photo\n            else:\n                label.config(image=None)\n                label.image = None\n\n    def show_previous(self):\n        if self.images:\n            self.current_image_index -= 10\n            if self.current_image_index &lt; 0:\n                self.current_image_index = 0\n            self.show_current_images()\n\n    def show_next(self):\n        if self.images:\n            self.current_image_index += 10\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index -= 10\n            self.show_current_images()\n\nif __name__ == \"__main__\":\n    viewer = ImageViewer()\n    viewer.mainloop()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-17-1024x625.png\" alt=\"\" class=\"wp-image-811\"\/><\/figure>\n\n\n\n<p>\u51fa\u529b\u3055\u308c\u305f\u30b3\u30fc\u30c9\u306f\u554f\u984c\u306a\u304f\u5b9f\u884c\u3067\u304d\u300110\u679a\u305a\u3064\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8ffd\u52a0\u6a5f\u80fd\u306e\u63d0\u6848\u3092\u3057\u3066\u3082\u3089\u3046<\/h2>\n\n\n\n<p>\u4fbf\u5229\u306a\u8ffd\u52a0\u6a5f\u80fd\u306e\u63d0\u6848\u3092\u304a\u9858\u3044\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-18.png\" alt=\"\" class=\"wp-image-812\"\/><\/figure>\n\n\n\n<p>\u3069\u308c\u3082\u4fbf\u5229\u305d\u3046\u3067\u3059\u3002\u4eca\u56de\u306f\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u306e\u6a5f\u80fd\u8ffd\u52a0\u3092\u304a\u9858\u3044\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-20.png\" alt=\"\" class=\"wp-image-814\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u51fa\u529b\u3055\u308c\u305f\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog\nfrom PIL import Image, ImageTk\n\nclass ImageViewer(tk.Tk):\n    def __init__(self):\n        super().__init__()\n\n        self.title(\"Image Viewer\")\n        self.geometry(\"800x600\")\n\n        self.current_image_index = 0\n        self.images = &#91;]\n        self.is_slideshow_running = False\n        self.slideshow_interval = 3000  # 3 seconds\n\n        self.label = tk.Label(self)\n        self.label.pack()\n\n        self.open_folder_button = tk.Button(self, text=\"Open Folder\", command=self.open_folder)\n        self.open_folder_button.pack()\n\n        self.prev_button = tk.Button(self, text=\"Previous\", command=self.show_previous)\n        self.prev_button.pack(side=tk.LEFT)\n\n        self.next_button = tk.Button(self, text=\"Next\", command=self.show_next)\n        self.next_button.pack(side=tk.RIGHT)\n\n        self.slideshow_button = tk.Button(self, text=\"Start Slideshow\", command=self.toggle_slideshow)\n        self.slideshow_button.pack(side=tk.RIGHT)\n\n    def open_folder(self):\n        folder_path = filedialog.askdirectory()\n        if folder_path:\n            self.images = &#91;\n                os.path.join(folder_path, file) for file in os.listdir(folder_path)\n                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))\n            ]\n            self.current_image_index = 0\n            self.show_current_image()\n\n    def show_current_image(self):\n        if self.images:\n            image_path = self.images&#91;self.current_image_index]\n            image = Image.open(image_path)\n            image.thumbnail((800, 600), Image.ANTIALIAS)\n            photo = ImageTk.PhotoImage(image)\n            self.label.config(image=photo)\n            self.label.image = photo\n\n    def show_previous(self):\n        if self.images:\n            self.current_image_index -= 1\n            if self.current_image_index &lt; 0:\n                self.current_image_index = len(self.images) - 1\n            self.show_current_image()\n\n    def show_next(self):\n        if self.images:\n            self.current_image_index += 1\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index = 0\n            self.show_current_image()\n\n    def toggle_slideshow(self):\n        if not self.is_slideshow_running:\n            self.is_slideshow_running = True\n            self.slideshow_button.config(text=\"Stop Slideshow\")\n            self.start_slideshow()\n        else:\n            self.is_slideshow_running = False\n            self.slideshow_button.config(text=\"Start Slideshow\")\n\n    def start_slideshow(self):\n        if self.is_slideshow_running:\n            self.show_next()\n            self.after(self.slideshow_interval, self.start_slideshow)\n\nif __name__ == \"__main__\":\n    viewer = ImageViewer()\n    viewer.mainloop()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-21.png\" alt=\"\" class=\"wp-image-818\"\/><\/figure>\n\n\n\n<p>\u300cStart Slideshow\u300d\u30dc\u30bf\u30f3\u304c\u8ffd\u52a0\u3055\u308c\u3001\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8ffd\u52a0\u306e\u4fee\u6b63\u4f9d\u983c<\/h2>\n\n\n\n<p>\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u4e2d\u306f\u300cStop Sllideshow\u300d\u3067\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u3092\u505c\u6b62\u3067\u304d\u307e\u3057\u305f\u3002\u305f\u3060\u300110\u500b\u305a\u3064\u306e\u8868\u793a\u304c\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u305d\u308c\u3092\u5fa9\u6d3b\u3055\u305b\u308b\u3088\u3046\u306b\u304a\u9858\u3044\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-22.png\" alt=\"\" class=\"wp-image-819\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u4fee\u6b63\u3055\u308c\u305f\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog\nfrom PIL import Image, ImageTk\n\nclass ImageViewer(tk.Tk):\n    def __init__(self):\n        super().__init__()\n\n        self.title(\"Image Viewer\")\n        self.geometry(\"1600x1200\")\n\n        self.current_image_index = 0\n        self.images = &#91;]\n        self.is_slideshow_running = False\n        self.slideshow_interval = 3000  # 3 seconds\n\n        self.labels = &#91;]\n        for i in range(2):\n            for j in range(5):\n                label = tk.Label(self)\n                label.grid(row=i, column=j)\n                self.labels.append(label)\n\n        self.open_folder_button = tk.Button(self, text=\"Open Folder\", command=self.open_folder)\n        self.open_folder_button.grid(row=2, column=2)\n\n        self.prev_button = tk.Button(self, text=\"Previous\", command=self.show_previous)\n        self.prev_button.grid(row=3, column=0)\n\n        self.next_button = tk.Button(self, text=\"Next\", command=self.show_next)\n        self.next_button.grid(row=3, column=4)\n\n        self.slideshow_button = tk.Button(self, text=\"Start Slideshow\", command=self.toggle_slideshow)\n        self.slideshow_button.grid(row=3, column=2)\n\n    def open_folder(self):\n        folder_path = filedialog.askdirectory()\n        if folder_path:\n            self.images = &#91;\n                os.path.join(folder_path, file) for file in os.listdir(folder_path)\n                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))\n            ]\n            self.current_image_index = 0\n            self.show_current_images()\n\n    def show_current_images(self):\n        if not self.is_slideshow_running:\n            for i, label in enumerate(self.labels):\n                image_index = self.current_image_index + i\n                if image_index &lt; len(self.images):\n                    image_path = self.images&#91;image_index]\n                    image = Image.open(image_path)\n                    image.thumbnail((300, 300), Image.ANTIALIAS)\n                    photo = ImageTk.PhotoImage(image)\n                    label.config(image=photo)\n                    label.image = photo\n                else:\n                    label.config(image=None)\n                    label.image = None\n\n    def show_previous(self):\n        if self.images and not self.is_slideshow_running:\n            self.current_image_index -= 10\n            if self.current_image_index &lt; 0:\n                self.current_image_index = 0\n            self.show_current_images()\n\n    def show_next(self):\n        if self.images and not self.is_slideshow_running:\n            self.current_image_index += 10\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index -= 10\n            self.show_current_images()\n\n    def toggle_slideshow(self):\n        if not self.is_slideshow_running:\n            self.is_slideshow_running = True\n            self.slideshow_button.config(text=\"Stop Slideshow\")\n            self.start_slideshow()\n        else:\n            self.is_slideshow_running = False\n            self.slideshow_button.config(text=\"Start Slideshow\")\n            self.show_current_images()\n\n    def start_slideshow(self):\n        if self.is_slideshow_running:\n            self.show_next()\n            self.after(self.slideshow_interval, self.start_slideshow)\n\nif __name__ == \"__main__\":\n    viewer = ImageViewer()\n    viewer.mainloop()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<p>\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u30dc\u30bf\u30f3\u306f\u5fa9\u6d3b\u3057\u307e\u3057\u305f\u304c\u3001\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u304c\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3055\u3089\u306b\u8ffd\u52a0\u306e\u4fee\u6b63\u4f9d\u983c<\/h3>\n\n\n\n<p>\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u304c\u5b9f\u884c\u3067\u304d\u306a\u3044\u3053\u3068\u3092ChatGPT\u306b\u4f1d\u3048\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-23.png\" alt=\"\" class=\"wp-image-820\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u3055\u3089\u306b\u4fee\u6b63\u3055\u308c\u305f\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog\nfrom PIL import Image, ImageTk\n\nclass ImageViewer(tk.Tk):\n    def __init__(self):\n        super().__init__()\n\n        self.title(\"Image Viewer\")\n        self.geometry(\"1600x1200\")\n\n        self.current_image_index = 0\n        self.images = &#91;]\n        self.is_slideshow_running = False\n        self.slideshow_interval = 3000  # 3 seconds\n\n        self.labels = &#91;]\n        for i in range(2):\n            for j in range(5):\n                label = tk.Label(self)\n                label.grid(row=i, column=j)\n                self.labels.append(label)\n\n        self.open_folder_button = tk.Button(self, text=\"Open Folder\", command=self.open_folder)\n        self.open_folder_button.grid(row=2, column=2)\n\n        self.prev_button = tk.Button(self, text=\"Previous\", command=self.show_previous)\n        self.prev_button.grid(row=3, column=0)\n\n        self.next_button = tk.Button(self, text=\"Next\", command=self.show_next)\n        self.next_button.grid(row=3, column=4)\n\n        self.slideshow_button = tk.Button(self, text=\"Start Slideshow\", command=self.toggle_slideshow)\n        self.slideshow_button.grid(row=3, column=2)\n\n    def open_folder(self):\n        folder_path = filedialog.askdirectory()\n        if folder_path:\n            self.images = &#91;\n                os.path.join(folder_path, file) for file in os.listdir(folder_path)\n                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))\n            ]\n            self.current_image_index = 0\n            self.show_current_images()\n\n    def show_current_images(self, is_slideshow=False):\n        if not self.is_slideshow_running or is_slideshow:\n            for i, label in enumerate(self.labels):\n                image_index = self.current_image_index + i\n                if image_index &lt; len(self.images):\n                    image_path = self.images&#91;image_index]\n                    image = Image.open(image_path)\n                    image.thumbnail((300, 300), Image.ANTIALIAS)\n                    photo = ImageTk.PhotoImage(image)\n                    label.config(image=photo)\n                    label.image = photo\n                else:\n                    label.config(image=None)\n                    label.image = None\n\n    def show_previous(self):\n        if self.images and not self.is_slideshow_running:\n            self.current_image_index -= 10\n            if self.current_image_index &lt; 0:\n                self.current_image_index = 0\n            self.show_current_images()\n\n    def show_next(self):\n        if self.images and not self.is_slideshow_running:\n            self.current_image_index += 10\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index -= 10\n            self.show_current_images()\n\n    def toggle_slideshow(self):\n        if not self.is_slideshow_running:\n            self.is_slideshow_running = True\n            self.slideshow_button.config(text=\"Stop Slideshow\")\n            self.start_slideshow()\n        else:\n            self.is_slideshow_running = False\n            self.slideshow_button.config(text=\"Start Slideshow\")\n            self.show_current_images()\n\n    def start_slideshow(self):\n        if self.is_slideshow_running:\n            self.show_current_images(is_slideshow=True)\n            self.current_image_index += 1\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index = 0\n            self.after(self.slideshow_interval, self.start_slideshow)\n\nif __name__ == \"__main__\":\n    viewer = ImageViewer()\n    viewer.mainloop()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<p>\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u306f\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u4e2d\u308210\u679a\u305a\u3064\u306e\u8868\u793a\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3055\u3089\u306b\u8ffd\u52a0\u306e\u4fee\u6b63\u4f9d\u983c<\/h3>\n\n\n\n<p>\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u4e2d\u306f1\u679a\u305a\u3064\u306e\u8868\u793a\u306b\u306a\u308b\u3088\u3046\u306b\u304a\u9858\u3044\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-26.png\" alt=\"\" class=\"wp-image-844\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u3055\u3089\u306b\u4fee\u6b63\u3055\u308c\u305f\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog\nfrom PIL import Image, ImageTk\n\nclass ImageViewer(tk.Tk):\n    def __init__(self):\n        super().__init__()\n\n        self.title(\"Image Viewer\")\n        self.geometry(\"1600x1200\")\n\n        self.current_image_index = 0\n        self.images = &#91;]\n        self.is_slideshow_running = False\n        self.slideshow_interval = 3000  # 3 seconds\n\n        self.labels = &#91;]\n        for i in range(2):\n            for j in range(5):\n                label = tk.Label(self)\n                label.grid(row=i, column=j)\n                self.labels.append(label)\n\n        self.open_folder_button = tk.Button(self, text=\"Open Folder\", command=self.open_folder)\n        self.open_folder_button.grid(row=2, column=2)\n\n        self.prev_button = tk.Button(self, text=\"Previous\", command=self.show_previous)\n        self.prev_button.grid(row=3, column=0)\n\n        self.next_button = tk.Button(self, text=\"Next\", command=self.show_next)\n        self.next_button.grid(row=3, column=4)\n\n        self.slideshow_button = tk.Button(self, text=\"Start Slideshow\", command=self.toggle_slideshow)\n        self.slideshow_button.grid(row=3, column=2)\n\n    def open_folder(self):\n        folder_path = filedialog.askdirectory()\n        if folder_path:\n            self.images = &#91;\n                os.path.join(folder_path, file) for file in os.listdir(folder_path)\n                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))\n            ]\n            self.current_image_index = 0\n            self.show_current_images()\n\n    def show_current_images(self, is_slideshow=False):\n        if not self.is_slideshow_running or is_slideshow:\n            for i, label in enumerate(self.labels):\n                if is_slideshow and i &gt; 0:\n                    label.config(image=None)\n                    label.image = None\n                    continue\n\n                image_index = self.current_image_index + i\n                if image_index &lt; len(self.images):\n                    image_path = self.images&#91;image_index]\n                    image = Image.open(image_path)\n                    image.thumbnail((300, 300), Image.ANTIALIAS)\n                    photo = ImageTk.PhotoImage(image)\n                    label.config(image=photo)\n                    label.image = photo\n                else:\n                    label.config(image=None)\n                    label.image = None\n\n    def show_previous(self):\n        if self.images and not self.is_slideshow_running:\n            self.current_image_index -= 10\n            if self.current_image_index &lt; 0:\n                self.current_image_index = 0\n            self.show_current_images()\n\n    def show_next(self):\n        if self.images and not self.is_slideshow_running:\n            self.current_image_index += 10\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index -= 10\n            self.show_current_images()\n\n    def toggle_slideshow(self):\n        if not self.is_slideshow_running:\n            self.is_slideshow_running = True\n            self.slideshow_button.config(text=\"Stop Slideshow\")\n            self.start_slideshow()\n        else:\n            self.is_slideshow_running = False\n            self.slideshow_button.config(text=\"Start Slideshow\")\n            self.show_current_images()\n\n    def start_slideshow(self):\n        if self.is_slideshow_running:\n            self.show_current_images(is_slideshow=True)\n            self.current_image_index += 1\n            if self.current_image_index &gt;= len(self.images):\n                self.current_image_index = 0\n            self.after(self.slideshow_interval, self.start_slideshow)\n\nif __name__ == \"__main__\":\n    viewer = ImageViewer()\n    viewer.mainloop()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/taskhub.jp\/magazine\/wp-content\/themes\/the-thor\/img\/dummy.gif\" data-layzr=\"https:\/\/bocek.co.jp\/media\/wp-content\/uploads\/2023\/04\/image-24-1024x546.png\" alt=\"\" class=\"wp-image-842\"\/><\/figure>\n\n\n\n<p>\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u306e\u753b\u50cf\u304c\u5c0f\u3055\u3044\u3067\u3059\u304c\u3001\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u306e\u3068\u304d\u306f\u4e00\u679a\u3060\u3051\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3053\u306e\u3042\u3068\u306f\u753b\u50cf\u3092\u5927\u304d\u304f\u3057\u3066\u4e2d\u592e\u306b\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u6307\u793a\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u306a\u3069\u304c\u8003\u3048\u3089\u308c\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u6b32\u3057\u3044\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u306a\u304c\u3089\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u8ffd\u52a0\u6a5f\u80fd\u306e\u63d0\u6848\u307e\u3067\u3057\u3066\u3082\u3089\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u601d\u3046\u3088\u3046\u306a\u7d50\u679c\u304c\u5f97\u3089\u308c\u306a\u3044\u5834\u5408\u3082\u3001\u6539\u5584\u3057\u3066\u307b\u3057\u3044\u3068\u3053\u308d\u3092\u304a\u9858\u3044\u3059\u308b\u3053\u3068\u3067\u5c11\u3057\u305a\u3064\u6539\u5584\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u5de5\u6570\u306e\u524a\u6e1b\u3084\u6a5f\u80fd\u3092\u7c21\u5358\u306b\u8272\u3005\u8ffd\u52a0\u3057\u3066\u4f7f\u3044\u5fc3\u5730\u3092\u8a66\u3057\u3066\u307f\u308b\u3068\u3044\u3063\u305f\u3053\u3068\u306b\u3082\u4f7f\u3048\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3042\u306a\u305f\u3082\u305c\u3072\u3001ChatGPT\u306b\u805e\u304d\u306a\u304c\u3089\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306fChatGPT\u3092\u5229\u7528\u3057\u3066\u3001\u753b\u50cf\u30d3\u30e5\u30fc\u30ef\u306ePython\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002 ChatGPT\u3092\u5229\u7528\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308c\u3070\u3001\u7d20\u65e9\u304f\u7c21\u5358\u306b\u6b32\u3057\u3044\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001\u6a5f\u80fd\u3092\u63d0\u6848\u3057\u3066\u3082\u3089\u3063\u305f\u308a\u3057\u306a\u304c [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/posts\/802"}],"collection":[{"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/comments?post=802"}],"version-history":[{"count":3,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":848,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/posts\/802\/revisions\/848"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/media\/846"}],"wp:attachment":[{"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/media?parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/categories?post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taskhub.jp\/magazine\/wp-json\/wp\/v2\/tags?post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}