Upload images to S3 with GUI using tkinter

This is the source code to create a GUI with tkinter and upload an image to S3 by pressing a button.

import tkinter
from boto3.session import Session

session = Session(aws_access_key_id='access_key_id',
                  aws_secret_access_key='secret_access_key_id')

s3 = session.resource('s3')
bucket = s3.Bucket('bucket-name')


def btn_click():
    bucket.upload_file('sample.png', 'sample.png')
    print("uploaded !")


root = tkinter.Tk()
root.title("Image Uploader")
root.geometry("300x200")

btn = tkinter.Button(root, text='upload', command=btn_click)
btn.pack()

root.mainloop()

By executing the script, the following GUI will be displayed. By pressing the upload button, the specified image will be uploaded to S3. キャプチャ.PNG

Thank you for reading until the end. Let's meet again.

ps. By the way, I used the following command when converting to exe with pyinstaller.

pyinstaller .\uploader.py --onefile --noconsole  --hidden-import=configparser

Recommended Posts

Upload images to S3 with GUI using tkinter
Upload images to Google Drive with Python
I tried to make Kana's handwriting recognition Part 3/3 Cooperation with GUI using Tkinter
Resize multipart.File type image with golang ~ Upload to S3
[S3] CRUD with S3 using Python [Python]
Cloud Functions to resize images using OpenCV with Cloud Storage triggers
How to not load images when using PhantomJS with Selenium
I tried to make GUI tic-tac-toe with Python and Tkinter
Let's upload S3 files with CLI
Create a python GUI using tkinter
Upload packages to PyPI using tokens
Easy GUI app with Tkinter Text
Use boto3 to mess with S3
Using Kali Linux Gui with WSL2
Upload and download images with falcon
GUI creation in python using tkinter 2
About building GUI using TKinter of Python
GUI creation in python using tkinter part 1
Learn to colorize monochrome images with Chainer
Make GUI apps super easy with tkinter
Create a GUI app with Python's Tkinter
Add images to iOS photos with Pythonista
Connect to s3 with AWS Lambda Python
Add Gaussian noise to images with python2.7
Upload what you got in request to S3 with AWS Lambda Python
How to search using python's astroquery and get fits images with skyview
Use boto to upload / download files to s3.
Try using S3 object upload and download with AWS SDK for Go v2
How to upload with Heroku, Flask, Python, Git (4)
Upload scraped artifacts in Scrapy Cloud to S3
Upload a large number of images to Wordpress
Cannot upload multiple images from form with FastAPI
View images on S3 with API Gateway + Lambda
Create a GUI executable file created with tkinter
Convert PDFs to images in bulk with Python
GUI image cropping tool made with Python + Tkinter
I want to display multiple images with matplotlib.
How to deal with SessionNotCreatedException when using Selenium
One liner to make Lena images with scipy
How to use tkinter with python in pyenv
Export RDS snapshot to S3 with Lambda (Python)
How to display images continuously with matplotlib Note
Upload files to Google Drive with Lambda (Python)
Anonymous upload of images using Imgur API (using Python)
[I want to classify images using Tensorflow] (2) Let's classify images
GUI programming with kivy ~ Part 5 Creating buttons with images ~
How to upload to a shared drive using pydrive
Try using Tkinter
Introduction to Tkinter 1: Introduction
MVC with Tkinter
Images created with matplotlib shift from dvi to pdf
Upload the image downloaded by requests directly to S3
How to write a GUI using the maya command
Create a native GUI app with Py2app and Tkinter
Try to dynamically create a Checkbutton with Python's Tkinter
How to upload with Heroku, Flask, Python, Git (Part 3)
Try projective transformation of images using OpenCV with Python
Easy way to scrape with python using Google Colab
Try to make RESTful API with MVC using Flask 1.0.2
How to upload with Heroku, Flask, Python, Git (Part 1)
Machine Learning with Caffe -1-Category images using reference model