py4d

 

Demo01

Page history last edited by Jan Kurianski 3 yrs ago

A simple Python evaluator: (Kylix ready)

 

  1. Create a new Form
  2. Drop a TMemo (or a TRichEdit)
  3. Drop a TPythonGUIInputOutput for displaying Python's messages
  4. Drop a TMemo for the source code
  5. Drop a TPythonEngine
  6. Connect the attribute IO of the TPythonEngine to the TPythonGUIInputOutput.
  7. Connect the attribute Output of TPythonGUIInputOutput to the TRichEdit.
  8. Drop a TButton and call it "Execute script"
  9. Double-click on the button and add:

PythonEngine1.ExecStrings( Memo1.Lines );

  1. That's all !
  2. Compile and execute.
  3. Write in the Memo1: print 2+2
  4. Click on the Execute button
  5. You should see in the Output window: 4

Comments (0)

You don't have permission to comment on this page.