-
Content Count
779 -
Joined
-
Last visited
-
Days Won
42
Everything posted by pyscripter
-
P4D does something similar with custom variants and the Varpyth unit.
-
Which flag do you pass to PyRun_StringFlags?
-
Any reason for not using P4D?
-
All of these suggestions can be implemented without modifying your python code. For example you can just add the suggested code to the PythonEngine.InitScript.
-
@vmishkaYou are using Delphi 10.4 (which is the reason for the problems you are facing). You need to upgrade to 10.4.1 or even better to the just released10.4.2. This is a new installation. You need to download the installer from Registered Products Portal (embarcadero.com)
-
exit() raises the SystemExit exception, which unlike other exceptions, results in process termination before control gets back to Delphi. To prevent process termination you can do one of the following: wrap the python code in a try: except SystemExit: as suggested by @fjames above "overwrite" the exit method by for example running the following code after the python engine is initialized: def _exit(): print("exit prevented") __builtins__.exit = _exit import sys sys.exit = _exit del(_exit) overwrite the SystemExit exception!
-
The design time packages are 32-bit so you need to add the paths to the 32-bit target. The group project contains runtime and designtime packages. You first need to compile/build the runtime packages for target 32-bits. Optionally and only if you want to build 64-bit applications with runtime package, build 64-bit runtime packages: - Python270.bpl - PythonVcl270.bpl - PythonFmx270.bpl Then install the Design time packages (these are always 32-bits) - dclPython270.bpl - dclPythonVcl270.bpl - dclPythonFmx270.bpl
-
10.4.2 Released today - available to download
pyscripter replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
I was bitten by this a few times in previous upgrades. This time I knew better... -
10.4.2 Released today - available to download
pyscripter replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
I think a (the) highlight of this release is fixing [RSP-27375] Compiler generates disadvantageous code for try/finally - Embarcadero Technologies. Thanks to @Mahdi Safsafifor coming up with a great suggestion and @Stefan Glienkefor creating the issue and pushing hard for its resolution. -
SVGIconImageList/Demo at master · EtheaDev/SVGIconImageList (github.com) is not a bad starting point for debugging. The treeview has no interaction with the rest of the program.
-
In the SvgIconImageList demo case, the application was compiled with the Windows default style and the error occurs when you change the style at runtime. I think that may be significant because it causes the controls to be recreated.
-
Did you see my answer in Demo34 + NumPy · Issue #287 · pyscripter/python4delphi (github.com)? Did you try what I suggested there?
-
The bug is not related to frames.
-
@Carlo Barazzetta SVGIconImageList/Demo at master · EtheaDev/SVGIconImageList (github.com) suffers from the same problem.
-
Native Svg parsing and painting in Windows
pyscripter posted a topic in RTL and Delphi Object Pascal
I am not sure many know that since the Windows Creators update, svg parsing and painting is natively supported and is part of Direct2D. I wanted to test this Windows feature, however, the first obstacle was that the Direct2d headers that come with Delphi are very very old. There are two open tickets in https://quality.embarcadero.com/. Direct2D 1.1 support missing (open since XE7!) Direct2D 1.2 and 1.3 support missing You may want to vote for them, since lack of good Direct2D support (includes DirectWrite) it is a bit of a shame. I then looked at other Direct2D translations and found two that are regularly updated. MfPack DelphiDX12 They both had some issues but that was a good start. It turned out that parsing and painting svg files to Canvas is quite straightforward. Once you establish a renderer (Vcl.Direct2d does this, but it is easy to do it from scratch) you can do everything with two lines of code. fDeviceContext5.CreateSvgDocument(fStream, D2D1SizeF(ClientWidth, ClientHeight), fsvgDocument); fDeviceContext5.DrawSvgDocument(fsvgDocument); You can check whether Svg is supported by: if Supports( rt, ID2D1DeviceContext5, fDeviceContext5) then And it is easy to do things like scaling, opacity, rotation, recoloring etc. The quality and speed appear to be quite good, but there are some limitations, the most important of which I think is the lack of support for the text element. I am attaching the source code of my test project (no dependencies) in case anyone wants to play with it. The Svg scales automatically as you resize the form. Svg.zip -
P4D supports named parameters as follows: requests.get('http://192.168.1.200/gci-bin/users', auth:=requests.HTTPDigestAuth('admin','admin') Please note the := notation.
-
Sometimes it helps to trap the SystemExit exception. This would avoid many abnormal application exits. try: """ Add your Python code here""" except SystemExit as e:
-
There are many ways to achieve what you want: 1. The ExecString has an overloaded form: procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals : PPyObject ); You can pass a new empty dictionary to the locals and globals argument if you do not want to "pollute" the interpreter namespace. 2. You can manually do the clean up as you suggest above. 3. A more advanced way is to use subinterpreters (have a look at TPythonThread.Execute), but this is more error prone.
-
pythondelphivar PythonDelphiVar thows AttributeError that object has no attribute 'Value' Python 3.9.1 32Bit
pyscripter replied to ChrSax's topic in Python4Delphi
Actually this is now fixed. Please try with the latest version. -
pythondelphivar PythonDelphiVar thows AttributeError that object has no attribute 'Value' Python 3.9.1 32Bit
pyscripter replied to ChrSax's topic in Python4Delphi
I can confirm the issue. Could you please open an issue at Issues · pyscripter/python4delphi (github.com) so that we can track the progress in resolving this? -
Wke4Delphi, alternative to dcef3 or cef4delphi
pyscripter replied to Edwin Yip's topic in Delphi Third-Party
Download the binary release. -
Wke4Delphi, alternative to dcef3 or cef4delphi
pyscripter replied to Edwin Yip's topic in Delphi Third-Party
Releases · weolar/miniblink49 (github.com) -
Delphi 64bit compiler RTL speedup
pyscripter replied to RDP1974's topic in RTL and Delphi Object Pascal
Off Topic: VTune also appears to be a free download (Fix Performance Bottlenecks with Intel® VTune™ Profiler). Any experience of using it with Delphi? -
Delphi 64bit compiler RTL speedup
pyscripter replied to RDP1974's topic in RTL and Delphi Object Pascal
Looks free to me. Free Intel® Software Development Tools End User License Agreements (intel.com) The license if fairly liberal. -
installing/Executing Python4Delphi App on MacOs (Lazarus) (could not map symbol "Py_DebugFlag")
pyscripter replied to matrix1233's topic in Python4Delphi
See also Import(Py_DebugFlag) fails on MacOS · Issue #27 · Alexey-T/Python-for-Lazarus (github.com)