# pie_chart_python.py
# September - 2026
# RJM Programming
# Thanks to https://www.w3schools.com/python/default.asp

import os
import matplotlib.pyplot as plt
import numpy as np
#import plotly.express as px
from PIL import Image

nums = []
sofar = 0

if len(nums) <= 0:
  while sofar < 100:
     print(f"Enter your percentage value regarding a pie chart where so far {sofar} has already been allocated.")
     anum = input()
     nums.append(int(anum))
     sofar += int(anum)
  
y = np.array(nums)

fig, ax = plt.subplots()

ax.pie(y)

fig.savefig("plot.png")

# Open the PNG image file
with Image.open("plot.png") as img:
    # Display the image using your system's default viewer
    img.show()
    
    # Optional: Load the data into memory so you can safely close the file
    img.load() 


exit()


  
