Skip to content

Commit adb405b

Browse files
committed
use matplotlib instead of cv2 for showing image on terminal, update readme
1 parent 6c8e9e0 commit adb405b

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ from moon.terminal_ui import TerminalUi
2121
2222
ui = TerminalUi()
2323
ui.set_moon_phase() #defaults to today's date
24-
ui.set_moon_image()
2524
ui.show()
2625
```
2726

@@ -32,7 +31,6 @@ from moon.jupyter_ui import JupyterUi
3231
3332
ui = JupyterUi()
3433
ui.set_moon_phase() #defaults to today's date
35-
ui.set_moon_image()
3634
ui.show()
3735
```
3836

moon/terminal_ui.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from moon.dialamoon import Moon
22
import cv2
3+
import matplotlib.pyplot as plt
34

45
class TerminalUi(Moon):
56
def show(self):
6-
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.")
7-
cv2.imshow(str(self.datetime), self.image)
8-
cv2.waitKey(0)
9-
print("Closing image...")
10-
cv2.destroyAllWindows()
11-
12-
7+
print("☽ the image will open up in a new window. It might be behind your terminal window.")
8+
try:
9+
plt.imshow(cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB))
10+
plt.show()
11+
print("Image closed.")
12+
except:
13+
e = sys.exc_info()[1]
14+
print("Error: %s" % e)

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
setup(
99
name = 'moon',
1010
packages = find_packages(),
11-
version = '1.0.6',
11+
version = '1.0.7',
1212
license='MIT',
1313
description = 'Gets moon visualizations courtesy of NASA/Ernie Wright',
1414
long_description_content_type="text/markdown",
1515
long_description = long_description,
1616
author = 'Sadie Parker',
1717
author_email = '[email protected]',
1818
url = 'https://github.com/spacerest/moon',
19-
download_url = 'https://github.com/spacerest/moon/archive/v_1_0_6.tar.gz',
19+
download_url = 'https://github.com/spacerest/moon/archive/v_1_0_7.tar.gz',
2020
keywords = ['MOON', 'ART'],
2121
install_requires=[
2222
'numpy~=1.16',
23-
'opencv-python~=4.1.1.26'
23+
'opencv-python~=4.2.0.34',
24+
'matplotlib~=3.2.1',
2425
],
2526
classifiers=[
2627
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)