Git Product home page Git Product logo

delphivcl4python's People

Contributors

checkdigits avatar jimmckeeth avatar lmbelo avatar lucioric2000 avatar priyatham10 avatar shaunroselt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delphivcl4python's Issues

I miss in P4D DelphiVCL the TTreeView and TListView

Hi I miss in DelphiVCL for Python, TTreeView and TListView both elements are actually standard for me and are used in almost all my projects. So DelphiVCL would be useless for me. Many say I should use a listbox or grid both is neither a TTreeView nor a TListView.

Does not belong here: Also in the DelphiFMX project there is a ListView but this has nothing to do with the normal representation more that is rather ne improved listbox.

Therefore it would be nice if these are implemented with.
Otherwise I have to bother with QT.

mfg Ark

TLinkLabel missing

Hi.

I tried making a LinkLabel, but seems like it doesn't exist yet. My code:

self.myLabel = LinkLabel(self)
self.myLabel.Parent = self
self.myLabel.Caption = "Hello World!"
self.myLabel.Font.Size = 85
self.myLabel.Width = 650
self.myLabel.Height = 150
self.myLabel.Left = (self.Width - self.myLabel.Width) / 2
self.myLabel.Top = (self.Height - self.myLabel.Height) / 2
self.myLabel.BevelKind = "bkTile"

NameError: name 'LinkLabel' is not defined

The delphivcl downloaded by python3.12 is not the correct version.

Python3.12 x64
C:>pip install delphivcl
Collecting delphivcl
Using cached
https://... delphivcl-0.1.24.tar.gz (12 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in delphivcl setup command: 'python_requires' must be a string containing valid version specifiers; Invalid specifier: '>=3.3<=3.10'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

Can only run DelphiVCL program once in spyder 5.x

I use spyder 5.x (https://www.spyder-ide.org/) a lot as my a Python IDE.

I can write a DelphiVCL program, eg the simple one below. When I run it the first time it shows correctly. If I try to run it again, the screen shows but then instantly closes. In order to get the form to show correctly, I have to restart the python kernel. Not a showstopper but a nuisance for those running code from spyder. Note that the DelpchVCL code runs fine from the command line with python myfile.py. Running Python 64bit 3.8.6 on Windows 10

  from delphivcl import *

  class MainForm(Form):

     def __init__(self, owner):
         self.Caption = "A VCL Form..."
         self.SetBounds(10, 10, 500, 400)
         self.Position = "poScreenCenter"
         self.OnClose = self.__on_form_close    

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

 def main():
       Application.Initialize()
       Application.Title = "Hello Python"
       Main = MainForm(Application)
       FreeConsole()
       Application.Run()
       Main.Destroy()

  main()

Issue with Delphi Rio 10.3.1 : install impossible

Hi everyone,

Seems that there is an install problem on Delphi Rio (10.3.1) as Vcl.DBGrids.TDBGrid do not own any ScaleValue method.

Any clue or Sydney+ is mandatory to use DelphiVCL4Python ?

Thanks a lot,
Jonas

Cannot find DelphiVCL.pyd

I am facing error while running sample python3 hellodelphivcl.py:

Traceback (most recent call last):
  File "hellodelphivcl.py", line 1, in <module>
    from delphivcl import *
  File "/home/mohi/.local/lib/python3.8/site-packages/delphivcl/__init__.py", line 22, in <module>
    package = new_import()
  File "/home/mohi/.local/lib/python3.8/site-packages/delphivcl/__init__.py", line 15, in new_import
    ld = loader.create_module(spec)
ImportError: /home/mohi/.local/lib/python3.8/site-packages/delphivcl/DelphiVCL.pyd: cannot open shared object file: No such file or directory

Any clues?

command line

I run setup.py with guiPY
I have this error for instalation

C:\Python\Python36-32\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'license_files'
warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: no commands supplied

could not find any info what to put in command line

ALSO TRIED python setup.py install

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\LimElect>cd G:\python\DelphiVCL4Python-main

C:\Users\LimElect>g:

G:\python\DelphiVCL4Python-main>python setup.py install
File "setup.py", line 23
retvalue = exec(opffilecontents, gbals, lcals)
^
SyntaxError: invalid syntax

G:\python\DelphiVCL4Python-main>

Form loses focus after OpenDialog closes

Hi everyone,
I wrote a small multi form program to stamp, split or combine pdfs using pikepdf:
These forms are called using:

def openStamper(self, Sender):
   form_stamper = Stamper_Form(Application)
   form_stamper.Show()

pdftool

If I click on "PDF auswählen" an OpenDialog shows up, that lets me pick the file which should get stamped using:

def btn_openpdfClick(self, Sender):
    self.OpenDialog1.Execute()                                              # Show open dialog to pick a file
    self.pdf_path = self.OpenDialog1.FileName                               # Get file path from open dialog
    self.edit_pdf.Text = self.pdf_path                                      # Show PDF path in disabled edit field

After choosing "open" in the dialog, the pdf_path is set correctly according to the selected file, but the stamper window loses focus and disappears behind the next open window on the desktop:
pdftool2

This is really annoying especially when the other program is in fullscreen mode. Is there any possibility to focus the window again after the OpenDialog closes?

Expose mouse wheel

Mouse wheel events are not exposed.
Se attached file with the proposed addition.

Wrapps OnMouseWheel and OnMouseWheelDown.
OnMouseWheelUp is then automatically exposed.

WrapVclControls.zip

VSCode intellisense not friendly

there are no symbols in delphivcl package
so developing in delphivcl will be very uncomfortable.

Code_2023-08-22_21-27-31

and pyqt for comparison:

Code_2023-08-22_21-29-08

so currently delphivcl is not a game changer for python

There is an issue with TToolBar

When the property PixelsPerInch of Form is 96, TToolBar can display normally. However, when it is not 96, such as 120, the program will encounter an error.
2

32 bit installation problem with solution

after install with pip in 32 environment we get :
Exception: <class 'ValueError'>: DelphiVCL module not found. Try to reinstall the delphivcl package

Solution:
copy the delphivcl.pyd (3.75 MB) and create a win32 dir in python37-32\lib\site-packages\delphivcl\win32\delphivcl.pyd

checked: eg.execStr('loader= importlib.machinery.ExtensionFileLoader("DelphiVCL",'+VCLHOME+')') 👍

Setting Color property of Panel and other components

Setting Color property of self works ok. Setting Color property of components placed on self does not work. True for all components that have a Color property like Panel, GroupBox aso. Does not work at runtime either. Other properties can be assigned without problem.

	def __init__(self, Owner):
	### object Form
		self.SetBounds(310, 137, 730, 256) #self
		self.Caption = 'Form1'
		self.Color = clSkyBlue  ###colors all components on form, even if ParentColor is set False for each component
		self.Font.Color = clWindowText
		self.Font.Height = -11
		self.Font.Name = 'MS Sans Serif'
		self.Font.Style = []
		self.OldCreateOrder = False
		self.PixelsPerInch = 96
		self.TextHeight = 13
	### object GroupBox1, parent self
		self.GroupBox1 = GroupBox(self)
		self.GroupBox1.Parent = self
		self.GroupBox1.SetBounds(20, 20, 266, 136) #GroupBox1
		self.GroupBox1.Caption = 'GroupBox1'
		self.GroupBox1.Color = clRed   ###does not work
		self.GroupBox1.SetProps(Parent=self, Color=clRed)  ###nor does this help
		self.GroupBox1.Font.Color = clWindowText

Is the OnClick event on a TListBox supported?

I can't seem to get the VCL OnCLick event of the TListBox to fire. I'm using

    self.lblProject.OnClick = self.lbProjectClick

to connect the event and this is the function for the event handler

def lbProjectClick (self, Sender):

I assume the OnClick event for a TListBox is working?

Memo generates access violation error

The Memo component generates an access violation error after changing the style of the application.

Example code:

import os
from delphivcl import *

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

class MainForm(Form):

    def __init__(self, owner):
        self.Caption = "Test Memo"
        self.SetBounds(10, 10, 500, 400)
        self.Position = "poScreenCenter"

        # Memo component
        self.txtMemo = Memo(self)
        self.txtMemo.SetProps(Parent=self)
        self.txtMemo.SetBounds(10, 40, 300, 100)

        # Auto-load new style
        self.__sm = StyleManager()
        self.__load_style()

    def __load_style(self):
        self.__sm.LoadFromFile(os.path.join(BASE_DIR, "Windows11_Modern_Dark.vsf"))
        self.__sm.SetStyle(self.__sm.StyleNames[1])

def main():
    Application.Initialize()
    Application.Title = "Checking DelphiVCL4Python"
    Main = MainForm(Application)
    Main.Show()
    Application.Run()
    Main.Destroy()

if __name__ == '__main__':
    main()

Minimize window button doesn't work

I've noticed that the minimize window button doesn't work, either writing the application in Python from scratch or exporting the GUI from Delphi.

Load Form Props from memory

Currently the LoadProps only supports loading a pydfm file. It's better to add a function to load props from a file object or a string. Therefore, we don't need to ship the pydfm file with the software release.

Python 3.11.0 Not supported

ImportError: DLL load failed while importing DelphiVCL: The specified module could not be found.

When I try

>>> from delphivcl import *

some thoughts from qt user

Hi.
I am a qt user and trying to do something in vcl/fmx to evaluate the possibility of switching to this framework.

What confuses me is the explicit specification of coordinates and size for widgets.
I very rarely use explicit coordinates in qt.
Everything is done through layouts, alignment and size policy.

In VCL I didn't find layouts at all.
FMX has layouts.
I tried GridPanelLayout, but it doesn't work the same way as in qt.
Align also works in a strange way.
Here is video of comparison .

2023-08-23_10-57-51.mp4

as you can see Label text has break line, but should fill all horizontal space.
Button has no minimal size and can be shrinked to zero.
Label don't restrict minimal Layout's size, thus when the Grid is reduced in size, the label is hidden behind the window.

maybe I'm doing something wrong. How can I get the same result as in qt ?

Error handling

There are still some Delphi components that are not supported in the Python export, such as Windows10 -> TNumberBox, if any of these components are present in the exported unit, the application does not run or trigger any errors. It would be helpful to have the cause to quickly identify the problem.

Additional components

As far as I understand, delphivcl works only with standard components. Is there a way to make it work with additional or 3rd party components? Thank you.

Error when running "SampleFormDesignExport"

I have been trying to run the SampleFormDesignExport demonstration. I am using Delphi 11 and Python 3.9 (64 bit). I am a fairly experience (but not expert) Delphi programmer but a newbie to Python.
The program is loaded fairly deep on my G drive.
Everything works up through the export. I open MainForm.py in PyScripter and add the code to execute, but I get an error when I try to run:
"Remote Server is not connected. Please reinitialize or disconnect the remote server."

The error occurs somewhere in the line that starts: "self.LoadProps"
I ran using External Run and it gave me an error code "0EEDFADE."
I have tried using both Win32 and Win64 options on Delphi, and I have tried the same thing with Delphi 10.4.
I re-watched the webinar section and am doing everything the same, so maybe it is a Python configuration error.
Any assistance would be appreciated.

Does not compile properly using PyInstaller

I made VCL for Python as shown on webinar "Introduction to Python GUI Development with Delphi for Python - Part 1: Delphi VCL for Python".
When I run thes 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:

error

Wrap TListView and TTreeView

We shall be wrapping the TListView and TTreeView components to make them available for the DelphiVCL Python package.

Mouse Handling not Supported

I noticed the OnMouseX events in TPaintBox are not handled.

File "frmMain.py", line 21, in init
self.PaintBox.OnMouseDown = 1#self.MouseDown
AttributeError: Error in setting property OnMouseDown
Error: You can only assign a callable to method property "OnMouseDown"

even though the field is present.

I note from

https://en.delphipraxis.net/topic/6011-onmousedownup-events/

which suggests MouseEvents are not yet handled. This seems a bit of an oversight

Generate stub files to facilitate development

Are there plans to develop stubs files to facilitate development and get to know the API without needing to consult the Delphi documentation?

I've been analyzing the Delphi documentation and I noticed that it is possible to automate the creation of stubs files by accessing the documentation and making a translation to the stub syntax, this would allow more than the creation of stubs files, it is a way to extract the text of the documentation from every function, method, property and event.

That is, it is possible to automate both the stubs files as well as the inclusion of the documentation extracted from Delphi for each property, function, method and etc!

How can I show matplotlib plots seamlessly in the GUI window?

I'm wondering how I can draw matplotlib plots to a Canvas?
I guess I can save plots in a memory image, then draw this image to the canvas in TPaintBox.OnPaint method.
But there will be no interaction. And I don't know if I maximize the Window, whether the image will look ugly.

Could anyone provide a matplotlib backend that uses DelphiVCL or DelphiFMX?

ListBox does not have all Properties in Python

First of all:

  • System: Windows 10 x64 Version 2004
  • Python: 3.10.4
  • delphivcl: 0.1.40

I've tried to delete selected items in ListBox and to log witch items should be deleted.
Deleting works with DeleteSelected(), but for logging I need to iterate over the list and if I use Selected[i]-property I get an error.

Error in getting property "Selected".
Error: Unknown attribute

Here a minimal:

# from delphivcl import *
import delphivcl as vcl
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)

class MyApp(vcl.Form):
    
    def __init__(self, Owner):
        self.Caption = "MyApp"
        self.SetBounds(100,100,700,500)
        
        # Button del
        self.del_task_btn = vcl.Button(self)
        self.del_task_btn.SetProps(
            Parent=self,
            Caption="Delete Task",
            OnClick = self.__del_task_on_click
        )
        self.del_task_btn.SetBounds(150, 120, 100, 30)
        
        # Listbox
        self.list_of_tasks = vcl.ListBox(self)
        self.list_of_tasks.SetProps(
            Parent=self,
            MultiSelect = True,
        )
        self.list_of_tasks.SetBounds(300, 50, 300, 350)
        
        self.OnClose = self.__on_form_close
        
        self.__fill_list()

    def __on_form_close(self, Sender, Action):
        Action.Value = vcl.caFree
    
    def __del_task_on_click(self, Sender):
        msg = f"{Sender.Caption}"
        lot = self.list_of_tasks
        # Delete only if at least one string in the list box is selected
        if lot.SelCount > 0: 
            logging.debug(f"Selected items: {lot.SelCount}")
            msg += ":\n\t" +'\n\t'.join([lot.Items[i] for i in range(lot.Items.Count) if lot.Selected[i]])
            lot.DeleteSelected()
        else:
            if lot.ItemIndex > -1:
                msg += f": {lot.Items[lot.ItemIndex]}"
                lot.Items.Delete(lot.ItemIndex)
            else:
                msg += f": {lot.Items[0]}"
                lot.Items.Delete(0)
        logging.debug(msg)
        
    def __fill_list(self):
        lot = self.list_of_tasks 
        for i in range(10):
            lot.Items.Add(str(i))
        
    
def main():
    vcl.Application.Initialize()
    vcl.Application.Title = "TODO App"
    app = MyApp(vcl.Application)
    app.Show()
    # vcl.FreeConsole()
    vcl.Application.Run()
    app.Destroy()
        
main()

BR ramooon1

Win32 install broken

On Python3.8 pip would not install Win32 lib folder. Manual download from github would result in a small file (only 3.3MB) and "NameError: name 'FileOpenDialog' is not defined" when running the sample.

Problem with virtualenv: "Could not open python 310.dll"

This project is simply awesome! Good job guys.

I'm having a problem while using virtualenvs

image

I did the same test using python 3.9 and the problem is the same.
The problem doesn' happens using the system Python installation (without venvs).

Thanks

Error when changing VCL styles. DelphiVCL 1.0.3

This issue has already been raised (issue #50, on March 18th by @fansxs). I started a discussion on the same topic, and @lmbelo asked me to raise it as an issue again.

The ActivityIndicator.py demo crashes when I try to change style. The "__on_load_style_click" function crashes at line:
"valid_style, style_info = self.__sm.IsValidStyle(style_file_path)".
Python (v3.10) returns the error message "TypeError: cannot unpack non-iterable bool object".

Removing the "style_info" variable allows the line to run, but then a different error is raised at the line "self.__sm.LoadFromFile(style_file_path)" :

TypeError: Call "LoadFromFile" returned a value that could not be converted to Python
Error: Unsupported conversion from TValue to Python value

Here is my version of the code:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.