#๐Ÿ”’ SVGUtils

34 messages ยท Page 1 of 1 (latest)

scarlet garnetBOT
#

@delicate fossil

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

delicate fossil
#

I'm very confused. I get an error

    ^^^^^^^^^^^^^
AttributeError: 'SVGFigure' object has no attribute 'transform'```
SVGUtils is a module, and so I'm not sure what to do, I tried to find documentation but it is very poor quality and I was wondering if someone smarter then me could help me understand it?
late sphinx
delicate fossil
#

Sorry - I'm not very smart. I modified my script a little, and it's working, but it's not working how it's intended.

late sphinx
#

I certainly wouldn't say this documentation is of 'very poor quality' ๐Ÿ™‚ but I haven't used it before personally

distant canopy
#

stop that

late sphinx
distant canopy
#

You don't help anybody when you self-deprecate.

delicate fossil
#

Sorry - wasn't intended as that. Just meant I might not understand it.

distant canopy
#

Learning new stuff can be hard especially if the documentation is obtuse.

delicate fossil
#

So I did use AI to help me, and it wrote a line that I understand what it does, but I don't understand how to do it another way

distant canopy
#

So don't use AI to help you.

#

AI won't help you.

delicate fossil
#
import svgutils.transform as sg

directory = "C:/users/aa/desktop/directorytest/"

angle_in_degrees = -25  

svg_file = f"{directory}test.svg"
svg_fig = sg.fromfile(svg_file).getroot()

svg_fig.skew_x(angle_in_degrees)

fig = sg.SVGFigure("16cm", "6.5cm")

fig.append(svg_fig)

fig.save("test_skewed.svg")
#

The line I don't understand is the

distant canopy
#

AI isn't guaranteed to produce working code.

#

ChatGPT will literally just make shit up.

delicate fossil
#

It's essentially initializing the SVG file, but it's giving it a size of 16cm,6.5cm.

distant canopy
#

Then you're banging your head against the wall for 30 minutes trying to figure out what's wrong.

delicate fossil
#

I don't understand how I would pull the size from the SVG it's loading

delicate fossil
distant canopy
#

If you don't know what you're asking GPT to do how will you know if it's giving you the correct information?

#

The answer is you don't - then you come here and say "I asked ChatGPT to help write my code" and someone lectures you about how that's a bad idea. :P

delicate fossil
#

I get it. My end goal is to have it skew that test.svg file so that it's angling (if it matters, I want it to be angling downwards to the right)

#

It's just a few letters. Right now, this script crops it, to be only 16cm and 6.5cm

#

So I want to figure out how to make that line take it's dimensions FROM The svg file.

#

When it does it right now, it crops it, and then it moves each individual object in the svg to be skewed, like this. I want it to be straight lettering, but the entire LINE skewed downwards.

#

Does that make any sense?

scarlet garnetBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ SVGUtils