kalmen
Members-
Content Count
4 -
Joined
-
Last visited
Everything posted by kalmen
-
Hi, 1. Is there a discord discussion group link that i can join ? ( i found one , https://discord.com/channels/989230637342933042/990834240608415834 , this is a correct forum related to this topic ?) 2. i have this simple python code, in the attached file , main.py - i wish to use a simple memo, 2 buttons (one for start_bot another for stop_bot) and when python4delphi component will read and execute script from main.py and add message receive from Telegram bot into the memo1. i have defined the following in delphi beside the main.py, 1. a pythonEngine and a pythonGUIInputOut component and set the relevant properties, i.e. IO to memo1. etc. 2. i have in my start_button try to executeStrings( memo1.lines) , but no result display my problem is i am unable to get the updates from the python , telegram bot , message receive into the Delphi(10.3)'s Form memo1. and i not even sure whether the bot is running. I have tested to run the python code. (in python 3.9) environment, it ran as expectedly. i am thinking to use the wrapDelphi to wrap the memo1 to the main.py by importing the memo1 component into the python script to add messages or clearing the memo1.lines , can any one help me by giving some advise , what do think i need to do or is wrapping the delphi memo1 component and change my python function i.e. echo() , handle_json() to change the content of the wrapped delphi's memo1.lines in the python code ? Thanks. main.py
-
how do i use P4D to receive Telegram bot message ?
kalmen replied to kalmen's topic in Python4Delphi
Hi, thanks for answering; sorry for the late reply because for down with covid virus & flu 😅(the virus is going to stay and long live like Delphi, since Delphi version 1.0 ). I agree with what u mentioned that is related to the thread sync because when I send a telegram message, I am expecting an echo back from my Delphi app with python4delphi running, I did get back the reply, but it only happened when I terminal, and exit the Delphi app. The echo "messages" will then appear on my Phone's Telegram App. And I am still learning how to use the thread & event in the examples, which I think managing in Python is hard and slow too. Thanks for sharing and for your kind assistance. -
how do i use P4D to receive Telegram bot message ?
kalmen replied to kalmen's topic in Python4Delphi
Thanks, Korif. The following advice, i can confirm the Python code was executed successfully in my Delphi app as attached, now after clicking button start , i am expecting that the Delphi app will wait for any message received and display them in the memo1 component, but it seems after the 1st run by clicking the start bot button, i think the telegram has stopped. Not sure how to wait for the message from telegram and then capture it and display the message to Delphi desktop app. Look to get some more input for this thanks. -
Hi, I am trying to get info. when do I need to use Py_XDecRef / Py_XIncRef ? i have a delphi object and i defined as follow, pyObj := PyDelphiWrapper.Wrap( myDatamodule.tblCustomer ); PythonModule1.SetVar( 'TCustomer' , pyObj ); Py_XDecRef(pyObj) ? or Py_XIncRed(pyObj) ? any advice is much appreciated , thanks.