Jump to content
EvgenyD

Using pyinstaller with DelphiVCL for Python

Recommended Posts

Hello.

 

I made VCL for for Python as shown on webinar "Introduction to Python GUI Development with Delphi for Python - Part 1: Delphi VCL for Python":

from delphivcl import *

class MainForm(Form):
    def __init__(self,Owner):
        self.Caption = "Delphi VCL Form"
        self.SetBounds(10,20,500,400)
        self.Position="poScreenCenter"

        self.lblHello = Label(self)
        self.lblHello.SetProps(Parent = self, Caption = "Hello Python")
        self.lblHello.SetBounds(10,10,100,30)

        self.OnClose = self.__on_form_close

    def __on_form_close(self, sender, action):
        action.Value = caFree


def main():
    Application.Initialize()
    Application.Title = "DelphiVCL Test"
    f = MainForm(Application)
    f.Show()
    FreeConsole()
    Application.Run()
    f.Destroy()

main()

When I run this code it works fine. VCL form is shown correctly.

But when I created a single exe-file using pyinstaller (pyinstaller -F -w --onefile testdelphivcl.py) and ran created exe-file I got the error:

image.thumb.png.440e4e09c2f83c5f48b44484b0c44e60.png

If I use tkinter, exe-file, created by pyinstaller works correctly.

 

Can you tell me the correct way to create single exe-file when I use delphivcl in python?

 

Thank you.

Share this post


Link to post

I would post it as an issue to the DelphiVCl GitHub repo. The error shows it can find the moduledefs.json file.

Share this post


Link to post

We resolved this issue in the DelphiVCL Github repo issues. Please have a look at: https://github.com/Embarcadero/DelphiVCL4Python/issues/12

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×