• 24-08-2024, 03:08:50
    #1
    Merhaba. Yazdırmış olduğum kodu PyInstaller ile .exe dosyasına dönüştürdüm aslında ama dosyada fazla kod yazılmamasına rağmen 29.1 MB ve biraz yavaş açılıyor. Bunu normal görmüyorum aslında. Bu sorunu nasıl çözebilirim?

    from PIL import Image
    from tkinter import Tk, filedialog, Button, Label
    def merge_images_to_pdf(image_list, output_pdf_path):
        # Open images and convert them to RGB mode (required for PDF)
        images = [Image.open(img).convert('RGB') for img in image_list]
        # Save the first image and append the rest to it
        images[0].save(output_pdf_path, save_all=True, append_images=images[1:])
    def choose_files():
        # Open file dialog to select multiple image files
        image_files = filedialog.askopenfilenames(
            title="Select JPG files to merge",
            filetypes=[("JPEG files", "*.jpg *.jpeg"), ("All files", "*.*")]
        )
        if image_files:
            # Define the output file path
            output_pdf = filedialog.asksaveasfilename(
                defaultextension=".pdf",
                filetypes=[("PDF files", "*.pdf"), ("All files", "*.*")],
                title="Save Merged PDF as"
            )
            if output_pdf:
                # Merge selected images into a single PDF
                merge_images_to_pdf(image_files, output_pdf)
                result_label.config(text=f"Merged PDF saved as {output_pdf}")
            else:
                result_label.config(text="No output file specified. PDF not saved.")
        else:
            result_label.config(text="No images selected.")
    if __name__ == "__main__":
        # Initialize the root Tkinter window
        root = Tk()
        root.title("Image to PDF Merger")
        # Create a "Choose Files" button and attach the choose_files function
        choose_button = Button(root, text="Choose Files", command=choose_files)
        choose_button.pack(pady=20)
        # Create a label to display results
        result_label = Label(root, text="")
        result_label.pack(pady=20)
        # Run the Tkinter event loop
        root.mainloop()
  • 24-08-2024, 03:11:49
    #2
    https://pypi.org/project/auto-py-to-exe/ ile kolayca halledebilirsiniz
  • 24-08-2024, 03:12:33
    #3
    Regnos.com
    pyinstaller —onefile dosya yolu
  • 24-08-2024, 03:14:33
    #4
    Centifolia adlı üyeden alıntı: mesajı görüntüle
    https://pypi.org/project/auto-py-to-exe/ ile kolayca halledebilirsiniz
    Hocam mesele hall etmek değil. Dosya boyutu yüksek oluyor ve dosya yavaş açılıyor. Bunu biliyorum teşekkürler.
  • 24-08-2024, 03:15:20
    #5
    Micron adlı üyeden alıntı: mesajı görüntüle
    pyinstaller —onefile dosya yolu
    Şu komutu biliyorum hocam mesele o da değil. Console'u da gizliyorum hatta ama mesela dosya boyutu yüksek oluyor ve yavaş açılıyor.
  • 24-08-2024, 03:16:42
    #6
    rufiqcavadov adlı üyeden alıntı: mesajı görüntüle
    Şu komutu biliyorum hocam mesele o da değil. Console'u da gizliyorum hatta ama mesela dosya boyutu yüksek oluyor ve yavaş açılıyor.
    one file kullanmak daha çok yavaşlatacaktır
  • 24-08-2024, 03:22:31
    #7
    Çünkü PIL ve TKInter paketleriyle birlikte paketliyor .exe dosyasını onun için oldukça büyük. --onefile yerine --onedir paketlemeyi denerseniz sanırım daha olumlu sonuç alırsınız
  • 24-08-2024, 18:32:32
    #8
    CihanAksoy adlı üyeden alıntı: mesajı görüntüle
    Çünkü PIL ve TKInter paketleriyle birlikte paketliyor .exe dosyasını onun için oldukça büyük. --onefile yerine --onedir paketlemeyi denerseniz sanırım daha olumlu sonuç alırsınız
    Böyle de olunca hocam yine yavaş açılıyor ve ayrıca dosya ile birlikte mi göndermem gerekiyor başka birisine örneğin çalıştırması için bilgisayarında?
  • 26-08-2024, 10:01:43
    #9
    • "pyinstaller --onefile --exclude-module=tkinter --exclude-module=numpy script.py" Tercih edilen kütüphaneleri dışlayabilirsin.
    • "pyinstaller --onefile --upx-dir=C:upx script.py" UPX (Ultimate Packer for eXecutables ) kullanarak dosyanızı sıkıştırabilirsiniz.



    Veya : Nuitka kütüphanesini tercih edebilirsiniz.