Skip to content

Commit

Permalink
use matplotlib instead of cv2 for showing image on terminal, update r…
Browse files Browse the repository at this point in the history
…eadme
  • Loading branch information
spacerest committed Apr 19, 2020
1 parent 6c8e9e0 commit adb405b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ from moon.terminal_ui import TerminalUi
ui = TerminalUi()
ui.set_moon_phase() #defaults to today's date
ui.set_moon_image()
ui.show()
```

Expand All @@ -32,7 +31,6 @@ from moon.jupyter_ui import JupyterUi
ui = JupyterUi()
ui.set_moon_phase() #defaults to today's date
ui.set_moon_image()
ui.show()
```

Expand Down
16 changes: 9 additions & 7 deletions moon/terminal_ui.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from moon.dialamoon import Moon
import cv2
import matplotlib.pyplot as plt

class TerminalUi(Moon):
def show(self):
print("☽ the image will open up in a new window. It might be behind your terminal window. To close the image, press any key while it's open.")
cv2.imshow(str(self.datetime), self.image)
cv2.waitKey(0)
print("Closing image...")
cv2.destroyAllWindows()


print("☽ the image will open up in a new window. It might be behind your terminal window.")
try:
plt.imshow(cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB))
plt.show()
print("Image closed.")
except:
e = sys.exc_info()[1]
print("Error: %s" % e)
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
setup(
name = 'moon',
packages = find_packages(),
version = '1.0.6',
version = '1.0.7',
license='MIT',
description = 'Gets moon visualizations courtesy of NASA/Ernie Wright',
long_description_content_type="text/markdown",
long_description = long_description,
author = 'Sadie Parker',
author_email = '[email protected]',
url = 'https://github.com/spacerest/moon',
download_url = 'https://github.com/spacerest/moon/archive/v_1_0_6.tar.gz',
download_url = 'https://github.com/spacerest/moon/archive/v_1_0_7.tar.gz',
keywords = ['MOON', 'ART'],
install_requires=[
'numpy~=1.16',
'opencv-python~=4.1.1.26'
'opencv-python~=4.2.0.34',
'matplotlib~=3.2.1',
],
classifiers=[
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit adb405b

Please sign in to comment.