From c6f28e48c3a7ccb4bc332e18dcb30c3ae4e0613b Mon Sep 17 00:00:00 2001 From: Nick <152164576+nicks-crumpets@users.noreply.github.com> Date: Wed, 27 Aug 2025 22:39:58 +0100 Subject: [PATCH] Update README.rst Define variable method inside this example making the example work --- README.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 27a0f82a..4f0f6c1d 100644 --- a/README.rst +++ b/README.rst @@ -122,9 +122,12 @@ Or in Python: .. code:: python + import qrcode import qrcode.image.svg - + + method = input("What method?: ") + if method == 'basic': # Simple factory, just a set of rects. factory = qrcode.image.svg.SvgImage @@ -134,8 +137,10 @@ Or in Python: else: # Combined path factory, fixes white space that may occur when zooming factory = qrcode.image.svg.SvgPathImage - + img = qrcode.make('Some data here', image_factory=factory) + + img.save('some_file.svg') Two other related factories are available that work the same, but also fill the background of the SVG with white::