Programming for Python

Is it possible to use the Xojo IDE to program in Xojo and compile for Python?

If you have a Xojo To Python Converter Application. (No).

you can use a plugin to launch python scripts from xojo. that’s all.
https://einhugur.com/Html/ScriptEngines.html

Hey Everyone,
I am unable to go open https://einhugur.com/Html/ScriptEngines.html .

The site is not reachable.

Is there any alternative to it.

I want to use Python Plugin for Xojo. Write Python codes in Xojo.

Thanks

Björn said something about a hardware failure at his hosting company. It seems that they are down again. Please be patient.

Hey Thanks @Beatrix Willius .

By any chance @Beatrix Willius, do you experience using OpenCV with Xojo.

I am really looking for some help there.

I was going to give a talk at the XDC this spring on using Xojo with Python and vis versa. You do not actually need a plugin to launch Python from Xojo.

I cannot quite parse this phrase. But if you are primarily a Python programmer, you can use Xojo with its IDE as a way of making a user interface for a Python program. When this is “perfected” then you can compile the Xojo app that you have created. But the app itself can be fairly hollow with all the guts of the program being what you have done in Python.

However, you are not calling Xojo from Python. Rather you get things started in Xojo. Xojo launches the various Python modules. The Python modules are themselves not compiled. Python is an interpreted language.

Hi,

I am sorry @Robert Livingston. I am quite new at Xojo and at overall programming, so I can moderately understand what you mean. :slight_smile:

I am a mechanical and electronics designer by heart, but all the fields be it mechanical / electronics / computers have now become dependent onto each other for ease of working. Also I find it quite fascinating to be able to code something and automate things, hence I have started taking keen interest in it.

I understand that Python is a wrapper of C and hence an interpreted language and yes, somewhere I understand that as you say you can launch the various modules from the Xojo App itself.

However, ( kindly excuse my half knowledge ), would the modules be needed to be operated by a python interpreter.

Also as you said, its very easy to use Xojo for making UI since its graphical, while a lot of work in upcoming fields AI and AR are having very good adaptions in Python.

Looking forward towards the XDC to hear you present the same.

More commonly, perhaps, for Xojo programmers would be a scenario that most of the code is in Xojo and you are using the ability to access Python just to utilize some capability of Python and its libraries that is not easy or possible in Xojo. You end up basically writing in Python something that looks roughly like a function when viewed from Xojo. Python returns some information that you can use in your Xojo program. However, the bulk of the program is written in Xojo.

As I see it, the most “inconvenient” part of marrying Python and Xojo in this fashion is that you do not end up with a nice little bundle wrapped with a ribbon. Rather you have to manage a computer with a Python installation as well as dealing with Xojo. It would be hard to make a commercial product in this fashion. One of the great things about Xojo is the relative ease of manging its computing environment and dealing with upgrades. Python installations and maintenance are, IMO, much more complicated. You would be taking on a huge support chore of managing your customer’s computing environment. It is much more doable if you are writing apps for yourself.

I am not a commercial developer, but I could imagine working on a project and debugging and designing it, etc. using some Python functionality. It would be a “proof of concept.” Once you got it to work and once you decided it was worthwhile, then you could take on the task of figuring out how to do the Python parts with Xojo or possibly Xojo and products from third-party developers (Monkey Bridge etc.)

Yes.

can’t you just call the python modules from xojo using a simple shell class ?

I suspect you know more that I.

But I am not sure exactly what you mean by this in terms of what I said if that comment was directed to my comments rather than the original poster.

Doesn’t this still mean that the Python code is being run interpreted in some particular version of Python that you have installed on your machine? And that it is your responsibility to “maintain” your Python installation etc.

If I do understand your question, yes you can and that is what I do.

I do not have experience with the Einhugur plug-in and what additional functionality/convenience it provides.

Hello @Jean-Yves Pochez,

I think yes, that’s what we would otherwise need to do.

But then I was thinking, what if the python code needs to have multiple IOs with the Xojo Apps ?
Would we be then required to write short python codes for each individual IOs and execute them independently.
Or the IO might be needed to specified with a classifier and some parsing would be required to be done by Python code as well as by the Xojo App. ( Just thinking ! ).

I am currently looking for a OpenCV face detection code. I would like to detect the face and identify the face. If the faces match, the user can be authenticated. I am making an app on timesheets. I want the timesheet to validate the user.

[quote]But then I was thinking, what if the python code needs to have multiple IOs with the Xojo Apps ?
Would we be then required to write short python codes for each individual IOs and execute them independently[/quote]

I am not sure what you are getting at here.

But…

You can use the ExecuteMode and set it to Interative which allows you to move data back and forth between Xojo and Python. There are other “tricks”. You can message back and forth by writing and reading a file that both Xojo and Python are aware of.

[quote=487507:@Robert Livingston]But I am not sure exactly what you mean by this in terms of what I said if that comment was directed to my comments rather than the original poster.
[/quote]
it was sort to both of you. I still don’t know in which case you need einhugur plugins for python ?

[quote=487514:@Gaurav Joshi]But then I was thinking, what if the python code needs to have multiple IOs with the Xojo Apps ?
Would we be then required to write short python codes for each individual IOs and execute them independently.
[/quote]
I would call the python method from xojo, and store the results in a file on the disk from python
and read them back from xojo once the process is finished ?

Thanks @Robert Livingston & @Jean-Yves Pochez

I really appreciate the valuable support.

I think Execute method in interactive mode looks like a great idea.

Frankly, I would get to know the finer details & finer queries as I build the app and reach nearer to the application, a small step at a time.

Just as a head up. Interactive mode is more “complex” so if the problem can be solved, as I and Jean suggested, using a file as a means of communication I would start with the default Synchronous mode. It is just easier as a starting point.

And even not using a file per se, you can return from Xojo complex data structures such as arrays or dictionaries using JSON.