-1

I am absolutely new to working with Python. Please help me compile to a standalone .app program attached below to create a simple QRcode from the clipboard. Or is it the wrong way and should I use java?

    import clipboard
    import qrcode
    import os
    import reportlab.lib.pagesizes
    from reportlab.pdfgen import canvas
    
    numer = clipboard.paste()
    nazwajpg = numer + '.jpg'
    nazwapdf= numer + "_id.pdf"
    
    qr = qrcode.QRCode(
        version=1,
        box_size=15,
        border=3
    )
    
    data = numer
    qr.add_data(data)
    qr.make(fit=True)
    img = qr.make_image(fill='black', back_color='white')
    img.save(nazwajpg)
        
    def hello(c):
        c.drawImage(nazwajpg, 12, 0, width=125, height=125)
        c.setFont("Helvetica-Bold", size=28)
        c.drawCentredString(76, 122, numer)
    c = canvas.Canvas(nazwapdf, pagesize=QR)
    
    hello(c)
    c.showPage()
    c.save(nazwapdf)
    
    os.remove(nazwajpg)
Abinav R
  • 365
  • 2
  • 16
  • custom page size QR = (53*mm, 53*mm) – ahapiotrek Sep 28 '20 at 09:57
  • 1
    Does this answer your question? [How to create a Mac OS X app with Python?](https://stackoverflow.com/questions/7261795/how-to-create-a-mac-os-x-app-with-python) – Random Davis Sep 28 '20 at 16:08
  • A MacOS app is basically an executable archive file. Do you actually need the extra part of compiling? – MisterMiyagi Sep 28 '20 at 16:11
  • I create .app via py2app with -A parameter and works fine. But in standalone version get main error, "ImportError: No module named rl_settings main Error". Ive reinstalled Reportlab several times and no progress. – ahapiotrek Sep 30 '20 at 10:44
  • And second way ive created app in Platypus, works fine on my Mac. But not on other one. Same lan network. https://drive.google.com/file/d/1jk_7ZX4MMM30MW3wIUqnNhwJ82yO3d5O/view?usp=sharing – ahapiotrek Sep 30 '20 at 10:48
  • Python applications are not compiled, they are interpreted. – Fadi Abu Raid Oct 29 '20 at 04:51

1 Answers1

0

The best way, as I know, is to use pyinstaller-- https://www.pyinstaller.org/ . This helped me create a windows executable and it should work with mac too.