#๐ SVGUtils
34 messages ยท Page 1 of 1 (latest)
@delicate fossil
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.
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?
https://svgutils.readthedocs.io/en/latest/transform.html has the class you're using, svgutils.transform.SVGFigure which tells you the methods it has. And transform() is not one of them.
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.
I certainly wouldn't say this documentation is of 'very poor quality' ๐ but I haven't used it before personally
I might just be stupid, too
Can you paste your updated code?
stop that
Give yourself a break, mate.
You don't help anybody when you self-deprecate.
Sorry - wasn't intended as that. Just meant I might not understand it.
Learning new stuff can be hard especially if the documentation is obtuse.
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
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
AI isn't guaranteed to produce working code.
ChatGPT will literally just make shit up.
It's essentially initializing the SVG file, but it's giving it a size of 16cm,6.5cm.
Then you're banging your head against the wall for 30 minutes trying to figure out what's wrong.
I don't understand how I would pull the size from the SVG it's loading
Yeah. I try to avoid it but when I'm really stuck it helps
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
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?
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