Jump to content
eivindbakkestuen

TComponent.Create() equivalent in Python script?

Recommended Posts

I'm playing around with Demo31, its very neat that we can do things like this in the .py script:

mytestform = CreateComponent("TForm", None)
mytestform.Caption = 'Hello Delphi-PRAXIS'
mytestform.Height = 1000
mytestform.ShowModal()

However, it would be even cooler if it was possible to use the Pascal style of creation:

mytestform = TForm.Create()

Unfortunately, playing around with the DelphilWrapper classes hasn't lead to anything working; I've tried things like these


 

  PyDelphiWrapper.RegisterDelphiWrapper(TPyClassWrapper<TForm>).Initialize;

  ...or... 

  PyDelphiWrapper.WrapClass(TForm);

 

Is there any way of registering Delphi classes, such that the someclass.Create() syntax would work in a .py script?

 

Share this post


Link to post
Posted (edited)

You can create instances of classes in the "pythonic" way:

 

myform = Form()

 

TForm.Create() is not supported (TForm is exposed in python as Form).

Edited by pyscripter

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

×