Write me a python code that processes a CSV file with the following structure ["Name","URL","Rating"], download each image under the URL row as save as PNG, use the Name as the file name and save it under a subfolder using the Rating as name, add a tkinter GUI to let me choose the CSV file and output path.
Here's a Python program with a TkInter GUI for downloading images specified in a CSV file with your provided format. Please note that the program requires the Requests library to be installed. You can install this library with, for example, the pip utility.

```python
import csv
import pathlib
import tkinter as tk
from tkinter.filedialog import askopenfilename, askdirectory
from tkinter import ttk, messagebox

import requests


class DownloadWindow:
    def __init__(self):
        self.csvfile = None
        self.outdir = None
        self.root = tk.Tk()
        self.root.geometry("200x100")
        self.filechoosebutton = ttk.Button(self.root, text='Choose CSV file', command=self.choose_file)
        self.filechoosebutton.pack()
        self.dirchoosebutton = ttk.Button(self.root, text='Choose output directory', command=self.choose_dir)
        self.dirchoosebutton.pack()
        self.runbutton = ttk.Button(self.root, text='Download files', command=self.download)
        self.runbutton.pack()

    def choose_file(self):
        self.csvfile = askopenfilename()

    def choose_dir(self):
        self.outdir = askdirectory()

    def download(self):
        if self.csvfile is None or self.outdir is None:
            messagebox.showerror(title='Error', message='CSV file or output path not provided!')
            return

        with open(self.csvfile, 'r') as file:
            reader = csv.reader(file)
            for line in reader:
                self.download_one(*line)

    def download_one(self, name, url, rating):
        output_directory = pathlib.Path(self.outdir) / rating
        output_directory.mkdir(parents=True, exist_ok=True)
        output_file = output_directory / f'{name}.png'
        response = requests.get(url)
        with open(output_file, 'wb') as out:
            out.write(response.content)

    def run(self):
        self.root.mainloop()


def main():
    download_window = DownloadWindow()
    download_window.run()


if __name__ == '__main__':
    main()
```
Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:

Write me a python code that processes a CSV file with the following structure ["Name","URL","Rating"], download each image under the URL row as save as PNG, use the Name as the file name and save it under a subfolder using the Rating as name, add a tkinter GUI to let me choose the CSV file and output path.

### Response:

Here's a Python program with a TkInter GUI for downloading images specified in a CSV file with your provided format. Please note that the program requires the Requests library to be installed. You can install this library with, for example, the pip utility.

```python
import csv
import pathlib
import tkinter as tk
from tkinter.filedialog import askopenfilename, askdirectory
from tkinter import ttk, messagebox

import requests


class DownloadWindow:
    def __init__(self):
        self.csvfile = None
        self.outdir = None
        self.root = tk.Tk()
        self.root.geometry("200x100")
        self.filechoosebutton = ttk.Button(self.root, text='Choose CSV file', command=self.choose_file)
        self.filechoosebutton.pack()
        self.dirchoosebutton = ttk.Button(self.root, text='Choose output directory', command=self.choose_dir)
        self.dirchoosebutton.pack()
        self.runbutton = ttk.Button(self.root, text='Download files', command=self.download)
        self.runbutton.pack()

    def choose_file(self):
        self.csvfile = askopenfilename()

    def choose_dir(self):
        self.outdir = askdirectory()

    def download(self):
        if self.csvfile is None or self.outdir is None:
            messagebox.showerror(title='Error', message='CSV file or output path not provided!')
            return

        with open(self.csvfile, 'r') as file:
            reader = csv.reader(file)
            for line in reader:
                self.download_one(*line)

    def download_one(self, name, url, rating):
        output_directory = pathlib.Path(self.outdir) / rating
        output_directory.mkdir(parents=True, exist_ok=True)
        output_file = output_directory / f'{name}.png'
        response = requests.get(url)
        with open(output_file, 'wb') as out:
            out.write(response.content)

    def run(self):
        self.root.mainloop()


def main():
    download_window = DownloadWindow()
    download_window.run()


if __name__ == '__main__':
    main()
```
