Jump to content

pyscripter

Members
  • Content Count

    779
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by pyscripter

  1. Please do. You will do everyone a favour.
  2. Call you delphi module say "delphimodule" and in your script: import delphimodule print(delphimodule.QUANTITY); or from delphimodule import QUANTITY print(QUANTITY) Please look at the demos, before asking questions here and do yourself a favour. Do watch the two video tutorials. It is only two hours viewing and will save you masses of time if you plan to do any serious work with P4D.
  3. Also do not call the module __main__. This is name is reserved for the main python module.
  4. There is no need for that. It has already been initialized.
  5. Create and link all non-visual components before you call LoadDLL.
  6. Set PyEngine.IO before you call LoadDLL Redirection is setup by TPythonEngine.Initialize, which is called by LoadDLL.
  7. You can use TPythonInputOutput event handlers to log python output to file or produce output in a console application.
  8. In a 5 year old answer to a stackoverflow question @David Heffernan responded that "class properties cannot be accessed via RTTI". Is this still the case with recent versions of Delphi?
  9. Watching the video tutorials I have pointed out and looking at the respective demos, would save you a lot of time.
  10. python4delphi/Demos at master · pyscripter/python4delphi (github.com) python4delphi/Tutorials at master · pyscripter/python4delphi (github.com)
  11. pyscripter

    no success in loading MiniConda with recommended setup

    I was just writing code from memory without testing. What you did is fine.
  12. pyscripter

    no success in loading MiniConda with recommended setup

    By the way, an easier way is to use PythonVersions. var PyVersion := PythonVersionFromPath('C:\MyApps\MConda38\envs\pg\'); PythonEngine1.Assign(PyVersion); PythonEngine1.LoadDLL;
  13. pyscripter

    no success in loading MiniConda with recommended setup

    You should not set VenvPythonExe. This is for environments created with venv and not Conda. The DLLName should be set before you call LoadDLL (e.g. in FormCreate) SetPythonHome: It should be called with the same directory as the DLLPath You may have to add the DLLPath to the environment path.
  14. pyscripter

    Python package in Python4Delphi

    P4D works fine with miniconda distributions. Read FindingPython · pyscripter/python4delphi Wiki (github.com) for details. There is no need to do that. If on the other hand you want to deploy python with your application, have a look at this project Embarcadero/PythonEnviroments: Components to simplify the deployment for Python environments for Delphi applications using Python4Delphi. (github.com)
  15. pyscripter

    Project Magician blues

    Project Magician by @Uwe Raabe is such a great idea, but somehow every time I decide to use it, I end up regretting it. This time the issue relates to custom manifest files. My project had one, but after activating Project Magician, saving and building my project this custom manifest file was not included. My application was released with a wrong manifest file. I went to Project Options, set it again, save my project, close, open again, the setting disappeared. What am I doing wrong? Delphi does not allow me to set the custom manifest for all configurations. It has to be set for each configuration individually.
  16. pyscripter

    Project Magician blues

    If you uncheck the event inherit in derived configurations, then you would need to define it again. The question is why Delphi replicates an event defined for All Configurations for each configuration and how you can prevent that.
  17. pyscripter

    Project Magician blues

    Alexandria with patches.
  18. pyscripter

    Project Magician blues

    Win32 and Win64. The problem was that the following was in the project file: <PropertyGroup Condition="'$(Cfg_2)'!=''"> <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> </PropertyGroup> which was overriding the platform settings. I don't know how this got into the project file. Project Magician was not cleaning it and this was overriding the platform settings. After deleting the Manifest line in the above, things seem to work as expected. One more question. I have a build event defined for all configurations. Delphi keeps one replicating that for every configuration: <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'"> <PreBuildEvent/> <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode> <PreLinkEvent/> <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode> <PostBuildEvent>copy "$(BDS)\Redist\$(Platform)\WebView2Loader.dll" $(OUTPUTDIR) </PostBuildEvent> <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode> </PropertyGroup> The above is replicated for all configurations. Even when I manually delete the above from the project file manually, Delphi recreates it. Any idea why? Could that be cleaned up?
  19. pyscripter

    Project Magician blues

    In Project Magician options "Clear Application Settings" is set on by default. But I still cannot set Manifest options for all configurations. How do I do that? Update: RTDS "All application settings in child configurations are removed and the base settings put in charge again. This effects the Icons, Manifest File, Output Settings and Appearance. Application settings are always platform based and thus the settings in the platform base configuration are the ones to be kept." I need to set them for each platform.
  20. There are a few choices when it comes to native processing and rendering of Unicode text in Windows applications. Namely, GDI, GDI+, UniScribe and DirectWrite. I have been doing some research in the process of updating/fixing the Unicode handling in SynEdit. It appears that the future lies with DirectWrite. Here are some reasons: WPF is based on DirectWrite Recent Microsoft applications, such as the Windows Terminal, use DirectWrite The Windows App SDK (new name of Project Reunion) is using a new cross-platform version of DirectWrite called DWriteCore, which is mostly compatible with DirectWrite. So presumably, switching to DWriteCore, if needed, would be easy. DirectWrite has many advantages including: Can play with GDI well, so you can mix the two. Supports color fonts Handles Unicode such as emojis reasonably well. Supports bi-directional text (e.g. mixing Arabic with English) Provides GPU acceleration. The downside is that it is fairly complex and there is not much Delphi Code that is using DirectWrite. Also the Delphi header translations have bugs and have not been updated for years (see [RSP-36642] CreateGdiCompatibleTextLayout is declared wrongly in Winapi.D2D1 - Embarcadero Technologies for instance). Further to the discussion in Unicode string - how element iterating? - RTL and Delphi Object Pascal - Delphi-PRAXiS [en] (delphipraxis.net), I have created a little demo which showcases rendering complex Unicode text with DirectWrite and also provides a Grapheme enumerator for Delphi strings also based on DirectWrite. Here is a screenshot. The ListBox shows the graphemes of the text. It is custom painted with DirectWrite. The Emoji consists of 7 unicode codepoints. See also fdwr/TextLayoutSampler: Utility to display text via multiple Windows API's simultaneously (D2D, DWrite, GDI, GDI+). (github.com) The source code of the project is attached. DirectWriteTest.zip
  21. pyscripter

    No modue named _ctypes

    A workaround for this python regression has been committed to the repo.
  22. pyscripter

    No modue named _ctypes

    Is this a failure to load the python DLL or an error when executing python scripts? Are you using the latest sources from the Github repo? Also check out the following: FindingPython · pyscripter/python4delphi Wiki (github.com) MaskFPUExceptions · pyscripter/python4delphi Wiki (github.com) If you are using python version 3.11.1 then please try with version 3.11.0 or earlier. There is a change related to the loading of dynamic libraries (dll) in 3.11.1, that I am looking into. See regression with latest Python 3.11.1 and _socket not found · Issue #100171 · python/cpython (github.com)
  23. Sorry. I meant iOS not supported.
  24. pyscripter

    Html Help: Ctrl+F not working

    I have just noticed that Ctrl+F does not work in my Desktop Delphi 11.2 help files. (Windows 11 22H2). But it works in my laptop, which is also Windows 11 22H2. Strangely Ctrl+F does not work with PyScripter help on either the Desktop or the Laptop. Weird.
  25. Please post questions regarding P4D to the Third Party P4D support forum. What is this InitThread? Using python threads requires deep knowledge of the Python API and the complexities of GIL. If do have to use threads, please study Demo 11 and the related posts in the P4D forum Showing results for 'Py_Begin_Allow_Threads'. - Delphi-PRAXiS [en] (delphipraxis.net)
×