Skip to content

Instantly share code, notes, and snippets.

@spinningcat
Created November 13, 2023 12:44
Show Gist options
  • Save spinningcat/34b8a0d0afd0a664b75d9f664cf1b5b0 to your computer and use it in GitHub Desktop.
Save spinningcat/34b8a0d0afd0a664b75d9f664cf1b5b0 to your computer and use it in GitHub Desktop.
import streamlit as st
import matplotlib.pyplot as plt
# Create a square using Matplotlib
def draw_square(ax, width, height, fill_color, edge_color):
square = plt.Rectangle((0, 0), width, height, fc=fill_color, ec=edge_color)
ax.add_patch(square)
ax.set_xlim(-0.5, width + 0.5)
ax.set_ylim(-0.5, height + 0.5)
ax.set_aspect('equal', 'box')
ax.axis('off') # Turn off axis
# Title
st.title('Transvoice App')
# Create two columns
col1, col2 = st.columns(2)
# Draw squares side by side with different colors
with col1:
draw_square(plt.subplots()[1], 1, 1, 'blue', 'black')
with col2:
draw_square(plt.subplots()[1], 1, 1, 'black', 'black')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment