CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-qrcode

QR Code image generator with customizable image formats, error correction levels, and styling options

42%

Overall

Evaluation42%

0.86x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-1/

Custom QR Code Module Drawer

Create a custom module drawer for QR codes that draws the regular QR modules as circles, but renders the position detection patterns (corner "eyes") with standard square shapes for better scannability.

Requirements

Your custom drawer should:

  1. Render all regular QR code modules (data modules) as circles
  2. Detect position detection patterns (the corner "eyes") and render them using square shapes
  3. Work with the StyledPilImage factory to produce a styled QR code
  4. Properly integrate with the qrcode package's styling system

Implementation

Create a file custom_drawer.py that implements your custom module drawer class. The drawer should extend the appropriate base class and implement the necessary methods to achieve the mixed styling (circles for data, squares for eyes).

Create a file test_custom_drawer.py that verifies your implementation works correctly.

@generates

Test Cases

  • The custom drawer correctly identifies eye patterns and draws them as squares @test
  • The custom drawer draws regular data modules as circles @test
  • A QR code generated with the custom drawer can be successfully created and saved @test

API

class CustomMixedDrawer:
    """
    A custom module drawer that renders data modules as circles
    and eye patterns as squares.
    """

    def __init__(self, size_ratio=0.8):
        """
        Initialize the custom drawer.

        Parameters:
        - size_ratio (float): Size ratio for the circle modules (0.0-1.0)
        """
        pass

Expected Output

When used with the qrcode package, your drawer should produce QR codes where:

  • Data modules are drawn as circles
  • The three position detection patterns (eyes) in the corners are drawn as squares
  • The QR code remains scannable

Example Usage

import qrcode
from qrcode.image.styledpil import StyledPilImage
from custom_drawer import CustomMixedDrawer

qr = qrcode.QRCode(
    error_correction=qrcode.constants.ERROR_CORRECT_H,
    image_factory=StyledPilImage
)
qr.add_data('Test QR Code')
qr.make()

img = qr.make_image(module_drawer=CustomMixedDrawer())
img.save('mixed_style_qr.png')

Dependencies { .dependencies }

qrcode { .dependency }

Provides QR code generation with customizable styling.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-qrcode@7.4.0
What are skills?

tile.json