AI Coding
Tried first project
first use Gemini to generate an svg image with python code to draw a circle and a text inside
it can successfully run.
then installed Cursor
did several round of chat based iterations, results are good
Here’s prompts tried
change text from Hope to Love
Use artistic font style for home decoration.
put the text into the center of the circcle.
all prompts got the right code changes. very impressive.
Here’s the final code
import svgwrite def generate_svg_image(text, circle_radius, text_size): """Generates an SVG image with a circle and text inside. Args: text: The text to display inside the circle. circle_radius: The radius of the circle. text_size: The size of the text. """ dwg = svgwrite.Drawing('circle_text.svg', size=('100%', '100%')) # Create the circle circle = dwg.circle(center=(100, 100), r=circle_radius, fill='white', stroke='black') # Create the text element with artistic font, centered in the circle text_element = dwg.text(text, insert=(100, 100), fill='black', text_anchor='middle', dominant_baseline='central', style=f"font-size:{text_size}px; font-family:'Brush Script MT', cursive; font-weight:bold;") # Add the elements to the drawing dwg.add(circle) dwg.add(text_element) # Save the SVG image dwg.save() if __name__ == '__main__': generate_svg_image("Love", 50, 30)