B4J Code Snippet [PyBridge] Few tips for library developers - Erel Mar 10, 2025 (4 reactions) This means that by default the events are raised there. If you want to handle events in your library code then you can call Py.SetEventMapping: Py.SetEventMapping("DeviceFound", Me, "Py") Py.SetEventMapping("DeviceDisconnected", Me, "Py") Py.SetEventMapping("CharNotify", Me, "Py") These calls over B4J Code Snippet [PyBridge] Windows 10/11 notifications - Erel Mar 12, 2025 (8 reactions) 162487 And if you want to handle the click event: ShowNotificationWithCallback("This is the title", "And this is the body", "B4J", 5) Private Sub Py_NotificationClick (Args As Map) Log("notification clicked: tag = " & Args.Get("tag")) End Sub B4J Tutorial [PyBridge] Linear regression with scikit learn - Erel (first post) Feb 17, 2025 (1 reaction) Good point. It is intended as it will make the zip very large.
You can make a copy of an existing python folder or change this line to point to an existing Python runtime:
Dim opt As PyOptions = Py.CreateOptions(File.Combine(File.DirApp, "Python/python/python.exe"))
In both cases you need to then B4J Tutorial [PyBridge][server] Using PyBridge in web apps - Erel Mar 16, 2025 (6 reactions) PyBridge must be accessed from a single thread. In server solutions, each handler runs in its own thread so we need to add some barriers to ensure proper usage. The way to implement it is by adding a background worker dedicated to PyBridge. Other handlers make requests to this worker using CallSubD B4J Question [pybridge] Using Multiple .py files - Erel (first post) Feb 18, 2025 (3 reactions) I've added a new Option.PythonPath field and it will be set together with PyBridgePath. B4J Tutorial [PyBridge] pyvips - image manipulation library - Erel Mar 19, 2025 (1 reaction) pyvips is a very powerful image manipulation library. It can manipulate very large images. I've created a modified "HugeImageView" based on it as an example. It can show 1-2 GB images. These are images that need special handling to draw, as the full image can't be loaded into RAM. It depends on an Bug? <Solved> [PyBridge] PyBridge.bas (in b4xlib) - Daestrum Feb 24, 2025 (1 reaction) Line 322 has </code></code> which stops the hint from showing in the IDE for 'Lambda'. B4J Code Snippet [PyBridge] Text to Speech with pyttsx3 - Erel Mar 16, 2025 (2 reactions) https://pyttsx3.readthedocs.io/en/latest/index.html
Dependency:
pip install pyttsx3
162622
Private Sub CreateEngine As ResumableSub
Ttsx3Engine = Py.ImportModule("pyttsx3").Run("init")
Dim voices As PyWrapper = Ttsx3Engine.Run("getProperty").Arg("voices")
'Get the voices names:
D B4J Code Snippet [PyBridge] Create barcodes - Erel Feb 16, 2025 (5 reactions) Based on: https://python-barcode.readthedocs.io/en/stable/getting-started.html Usage: Wait For (CreateBarcode("code128", "abcdef")) Complete (Result As B4XBitmap) ImageView1.SetBitmap(Result) 'dependencies: pip install python-barcode "python-barcode" 'Types: Private Sub CreateBarcode (CodeTyp B4J Tutorial [PyBridge] Tips to make life easier - Daestrum Feb 17, 2025 (3 reactions) 1, Download VSCode to edit the Python source files (you get hints etc)
2, Put the Python source code in files directory. (set external tool to VSCode for easy editing)
3, Run the code from File.DirAssets folder. Your B4J code will look much cleaner without the Code = $"..."$ lines.
Dim res As PyWra Page: 1 2 3 4 5 6 7 Powered by ColBERT |