DelphiPythonPython GUIWindows

Learn to Automatically Generating A CLIs Using Python’s Fire Library In A Delphi Windows App

pexels-tima-miroshnichenko-5380590

Are you looking for powerful tools to automatically generate command-line interfaces to make your life easier, and build a nice GUI for them? You can build it easily by combining Fire and Python4Delphi library, inside Delphi and C++Builder.

Python Fire is a library for automatically generating command-line interfaces (CLIs) with a single line of code.

It will turn any Python module, class, object, function, etc. (any Python component will work!) into a CLI. It’s called Fire because when you call Fire(), it fires off your command.

Python’s Fire library will enable us to:

  • Python Fire is a simple way to create a CLI in Python. [1]
  • Python Fire is a helpful tool for developing and debugging Python code. [2]
  • Python Fire helps with exploring existing code or turning other people’s code into a CLI. [3]
  • Python Fire makes transitioning between Bash and Python easier. [4]
  • Python Fire makes using a Python REPL easier by setting up the REPL with the modules and variables you’ll need already imported and created. [5]

Hands-On

This post will guide you on how to automatically generate your own CLI using the Fire library and create it using Python for Delphi in the Delphi Windows GUI app.First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.

0_rundemo1-6813476

Let’s create a CLI for a simple “Hello World!”:

And run it in our Python GUI:

1-8791201

Save the script above as helloFire1.py, and then let’s test our CLI for printing “Hello World!” using these commands:

2-6508457

 

Congratulations, now you have learned how to automatically generate your own CLI using the Fire library and create it using Python for Delphi in the Delphi Windows GUI app!

Check out the Fire library for Python and use it in your projects: https://pypi.org/project/fire/ and

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi: https://github.com/pyscripter/python4delphi

Check out DelphiVCL which easily allows you to build GUIs for Windows using Python!

close
Related posts
Learn PythonPythonPython GUIVideos

How To Make Your Data Visualization Effective

DelphiDelphiVCLPythonPython GUIWindows

This Is A List Of All Routines And Classes in the VCL

DelphiDelphiVCLPythonPython GUIWindows

What is DelphiVCL.Application.CreateHandle?

DelphiDelphiVCLPythonPython GUIWindows

Creating A New Application With DelphiVCL.Application.Create

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

jaJapanese