Jump to content

Search the Community

Showing results for tags 'dict'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. Hi all, I would like to add, to a python4delphi module, a getter method which return a 'dict'. For example: > import pycnccore1 as pyc >cnc_core = pyc.CNCCore() >print(cnc_core.paths) {'user_path': 'c:\\xyz', 'machine_path': 'd:\\machine_test', and so on} I don't know how to create a Delphi type to contain the dictionary and convert it to a Python dict as a result of the getter method. function TPyCNCCore.GetPaths(AContext: Pointer): PPyObject; begin Adjust(@Self); var PathDict: <i_do_not_know>; PathDict.Append('user_path', Self.UserPathString); PathDict.Append('machine_path', Self.MachinePathString); ... and so on ... Result := GetPythonEngine.VariantAsPyObject(PathDict); end; class procedure TPyCNCCore.RegisterGetSets(PythonType: TPythonType); begin inherited; with PythonType do begin PythonType.AddGetSet('paths', @TPyCNCCore.GetPaths, nil, 'Returns the used paths', nil); end; end; Thanks in advance for your suggestions Silverio
×