import streamlit as st import calendar # Define images for each month (seasonal backgrounds) - you can change this to URLs of your choice month_images = { 1: "https://via.placeholder.com/150/0000FF/808080?Text=January", # Placeholder image for January 2: "https://via.placeholder.com/150/FF0000/FFFFFF?Text=February", # Placeholder image for February 3: "https://via.placeholder.com/150/00FF00/FFFFFF?Text=March", # Placeholder image for March 4: "https://via.placeholder.com/150/FFFF00/000000?Text=April", # Placeholder image for April 5: "https://via.placeholder.com/150/FF00FF/FFFFFF?Text=May", # Placeholder image for May 6: "https://via.placeholder.com/150/00FFFF/000000?Text=June", # Placeholder image for June 7: "https://via.placeholder.com/150/FF7F00/FFFFFF?Text=July", # Placeholder image for July 8: "https://via.placeholder.com/150/7FFF00/000000?Text=August", # Placeholder image for August 9: "https://via.placeholder.com/150/8A2BE2/FFFFFF?Text=September", # Placeholder image for September 10: "https://via.placeholder.com/150/FF1493/FFFFFF?Text=October", # Placeholder image for October 11: "https://via.placeholder.com/150/DC143C/FFFFFF?Text=November", # Placeholder image for November 12: "https://via.placeholder.com/150/800080/FFFFFF?Text=December", # Placeholder image for December } # Function to display the full calendar for a specific month and year def display_full_calendar(year, month): # Display the month and year st.write(f"### {calendar.month_name[month]} {year}") # Get the calendar for the month (returns a list of weeks) month_calendar = calendar.monthcalendar(year, month) # Days of the week headers days_of_week = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] # Set the background image for the month bg_image_url = month_images.get(month, "") st.markdown( f""" """, unsafe_allow_html=True) # Create the table table_html = "
{day} | " table_html += "||
---|---|---|
" # Empty cell for days not in the month else: # Color weekends (Saturday and Sunday) if i == 5 or i == 6: table_html += f" | {day} | " else: table_html += f"{day} | " table_html += "