Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Update 0.2.0 Image-Viewer
Browse files Browse the repository at this point in the history
In this update, I added a viewing of the license, github and version number from the application.
it is also now called Image-Viewer.
  • Loading branch information
riderius committed Oct 3, 2020
1 parent 7f18ce0 commit 22ca2ca
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 24 deletions.
Binary file added Image-Viewer.exe
Binary file not shown.
87 changes: 72 additions & 15 deletions Main.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,80 @@
""" This is the main file to launch the Image-Viewer. """

import sys
from tkinter import *
import webbrowser
from tkinter import Tk, Menu, Canvas, messagebox
from PIL import Image, ImageTk

file_path = str(sys.argv[1])
LICENSE_TEXT = """
MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""


def show_license():
""" This function shows the license. """

messagebox.showinfo('License', LICENSE_TEXT)

def opening_github():
""" This function opens the github. """

webbrowser.open('https://github.com/RIDERIUS/Image-Viewer')

def show_version():
""" This function shows the version. """

messagebox.showinfo('Version', 'Version 0.2.0')

def main():
""" Main function in the image viewer. """

file_path = str(sys.argv[1])

image_pil = Image.open(file_path)
(width, height) = image_pil.size
image_pil = image_pil.resize(
(width, int(image_pil.size[1] * (width / image_pil.size[0]))), Image.ANTIALIAS)

root = Tk()
root.title("Image-Viewer")
root.geometry(f'{width}x{height}')
root.resizable(False, False)

imagePIL = Image.open(file_path)
(width, height) = imagePIL.size
imagePIL = imagePIL.resize(
(width, int(imagePIL.size[1] * (width / imagePIL.size[0]))), Image.ANTIALIAS)
menu = Menu(root)
new_item = Menu(menu)
new_item.add_command(label='License', command=show_license)
new_item.add_command(label='Github', command=opening_github)
new_item.add_command(label='Version', command=show_version)
menu.add_cascade(label='About', menu=new_item)
root.config(menu=menu)

root = Tk()
root.title("Picture reader")
root.geometry(f'{width}x{height}')
root.resizable(False, False)
image = ImageTk.PhotoImage(image_pil)

image = ImageTk.PhotoImage(imagePIL)
canv = Canvas(root, width=width, height=height)
canv.create_image(width / 2, height / 2, image=image)
canv.pack()

canv = Canvas(root, width=width, height=height)
imageSprite = canv.create_image(width / 2, height / 2, image=image)
canv.pack()
root.mainloop()

root.mainloop()
main()
Binary file removed Picture-reader.exe
Binary file not shown.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Picture-reader
# Image-Viewer

[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)

[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com)

Hi! **Picture-reader** is a Windows picture reader based on Python 3.8.
Hi! **Image-Viewer** is a Windows image viewer based on Python 3.8.

## Using:

You must download "Picture-reader.exe" from the root of the repository. Then you have to open the image with "Picture reader.exe".
You must download "Image-Viewer.exe" from the root of the repository. Then you have to open the image with "Image-Viewer.exe".

![OpenFile](https://image.prntscr.com/image/EmCtDUhDTH_HHxAgBFwLag.png)
![OpenFile](https://image.prntscr.com/image/wbp7ZkYURHW2kH31pf-TFA.png)

Then you will see a window like this:

![Picture](https://image.prntscr.com/image/mfNX2USsREu--i70QjsyYA.png)
![Picture](https://image.prntscr.com/image/Xem6tkkkT8SKmUA9bZi-aQ.png)

## Modules Used:

Expand All @@ -28,16 +28,16 @@ Python 3.8 or higher is recommended for using this program. You need to install

## Compilation

Picture-reader is compiled with pyinstaller. This command is used for this.
Image-Viewer is compiled with pyinstaller. This command is used for this.

> pyinstaller -F -i icon.ico -w -n Picture-reader main.py
> pyinstaller -F -i icon.ico -w -n Image-Viewer main.py
You can see what these parameters mean in the [pyinstaller documentation](https://pyinstaller.readthedocs.io/en/stable/usage.html#options).

## Versioning

**Picture-reader** uses [Semantic Versioning](https://semver.org/).
**Image-Viewer** uses [Semantic Versioning](https://semver.org/).

## License

This project is licensed under the MIT License, see the [LICENSE](https://github.com/RIDERIUS/Picture-reader/blob/main/LICENSE) file for details.
This project is licensed under the MIT License, see the [LICENSE](https://github.com/RIDERIUS/Image-Viewer/blob/main/LICENSE) file for details.

0 comments on commit 22ca2ca

Please sign in to comment.