Jump to content

diaroeh

Members
  • Content Count

    9
  • Joined

  • Last visited

Posts posted by diaroeh


  1. Dear pyscripter,

    thanks for your Demos, I have studied and tested them.

    Even just the less simple Demo was very interesting.

    I never thought that a standard TMemo could be too slow,
    even I never thought that I need a TCriticalSection in a normally
    not critical state, also when using VCL and not FMX there has been
    no problems.
    But maybe it is the price for developement on different platforms?

    However, thank you very much, good to know that there is not really
    a problem running python4delphi under FMX and now I know that FMX
    has just to mannered in a different way.


    Cheers

    Dirk


  2. Dear pyscripter :

    Ok, this is what I am doing at this moment, nothing spectactular, just like examples :

    1 (Main-)Form
    1 TPythonEngine
    1 TPythonGUIInputOutput
    1 TPythonDelphiVar
    3 TMemos (Python-Script(Input),GUI-IO, DelphiVar-IO(later))
    1 Button to Start Script
    Thats all on Components

    Button-ClickEvent :
    PythonEngine1.ExecuteString(Memo1.Lines);

    Python-Script itself :
    #-------------------
    import time

    for i in range(1,5) :
    print(i)
    time.sleep(1)
    print("Done ...")
    #-------------------

    Running this under FireMonkey(Win64) :
    Memo2(GUI-IO) is updated after 5 seconds
    - DelayWrites doesn't change behaviour

    Running this under VCL(Win64) :
    Memo2(GUI-IO) is updated every second (as expected)

    Did you mean that FMX did not repaint after pyscipt::print(), but VCL did?


  3. Dear all,

    in addition to my last post I want to say, that the problem (no print() output during script execution) is a
    behaviour, that seems to happens under FMX development, using VCL I got a normal print() as expected
    every second.
    @pyscripter : You know a reason why ?

    Thanks in advance for your answer.

    Sincerely

    Dirk


  4. Dear all,

     

    I thank you all for your manifold answers, informations and discussions,

     

    I have experienced for sometimes in the last months and I saw the problem,

    that I have tried to explain, maybe not in the best matter.

     

    My task is to build up a GUI-Application on existing python scripts, and therefore 

    Multithreading is not a central question. Pragmatically it will be used/implemented 

    if it is neccessary. 

     

    I have understood the GIL system and therefore my goal is not! a multithreading  application,

    but

    1. Delphi GUI-Thread is not blocked

    2. Interaction between python-script and Delphi application during script execution,

        this means at first

        - output from script was given to TPython(GUI)InputOutput immediatly

        - Setting a value to a variable like myVar01.value in Delphi was registered in Python-Script during execution and vice versa

     

    In my tests/experience (without using) TPythonThread a script like :

    -----------------------------------------------------

    for i in range(1,10):
        print(i) 
        myVal01.value=i //(DelphiVar)

        time.sleep(1)

    -----------------------------------------------------

    generates :

    - print()-output on TPython(GUI)InputOutput

    - changes on myValue via notify

    both first after!! execution of the whole scipt,

    which means in this example 10 seconds

     

    So the first problem (blocked GUI) can be solved easily by using TPythonThread.

     

    But I just don't see the solution to get response/interaction from the script during execution,

    my sorrow, that there also I have to wait finishing the script (e.g. for response for 10 seconds)

    when it is running in a thread.

     

    If this is running, everything is fine for me, independent from multithreading or not.

    At this point I am asking me if I have overlooked somthing.

     

    Thanks for the direct hint on TPythonThread and IO... 

    and any hint that will come ...

     

    Sincerely

     

    Dirk


  5. Dear all,

     

    after testing Python4Delphi which is, I think, a good bridge/library between these two worlds, 

    I would like to know if it is right that on standard, the python scripts are running in the main thread

    of the program, so that the GUI is blocked as long as the python script is running and that there are

    also no callback (NotifyEvents) available during this time. This is the behavior that I observed.

    Or is there a switch/paramter on e.g. TPythonEngine so that interprocess GUI communication is

    available during python script execution?

     

    If communication is only possible when the script execution is running in a seperate thread, what is

    about TPythonGUIInputOutput and the interprocess communication ?

    Does it mean that this class as GUI object is always executed in main  thread and therefore it is not

    threadsafe?

     

    Thanks for your kind answers  :classic_biggrin:

     

    Sincerely 

     

    Dirk


  6. Hi everybody,

     

    I just have to develope some GUI for existing python script which are using python's subprocess.

     

    On testing with python4delphi and TPythonGUIInputOutput it seem's that python.subprocess is

    ignored and never called.

     

    Any idea to run and access on subprocess-modules or is it not possible with python4delphi.

     

    Thanks in advance

     

    Dirk

×