Python at front end and C++ at backend - python

I am supposed to develop GUI using python for an application coded in C++. It is to be used as a PyMOL plugin.
How do I decide among the different options like ctypes, Boost.Python, SWIG, wxPython or Pyrex(?)?
I'm quite new to Python and have had very little experience with C/C++.
Also, I have the Python code for GUI of a similar application. How can I identify the type of Python-C++ interface used in it?
I don't see any of the following in the Python code:
import wx
from ctypes import *

Related

Is it impossible to create GUI in python without tkinter?

I wanna know, Is it possible to create GUI in python without using tkinter?
Tk isn't technically making the GUI, it's delegating to a C library; and that's exactly what you can do too. For simplicity however, it's pretty much standard to use TkInter, or some other framework (i recommend PySimpleGUI) that takes care of the Tk interaction for you
easygui is the easiest GUI python that I have used. Designs are prebuilt for you already. Examples of easygui can. be found here https://pypi.org/project/easygui/
You can also use Flask where the frontend will be the web browser.
Tcl/Tk is an external library although it comes as part of the standard python install and it is an external library. you can use other framework to do that .
Fundamentally, Python can’t talk to any GUI system without an external module. Since the most fundamental GUI libraries on any platform are usually C-based, that requires, at minimum, importing a library like ctypes which itself is minimal and allows you to load system GUI libraries (in dlls or delis, depending on your platform).It is possible, in theory at least, to drive a GUI solely from ctypes, but it’s not very practical .

So if you can't make GUI's with just pure Python, how does Tkinter do it?

So, I have been wanting to make my own GUI library for Python 3. And I couldn't find anything anywhere on where to start. So I decided to ask the question here.
Goal:
Be able to make Python Libraries without using other libraries.
Edit:
So, If I was to make a Library in C for Python. How would I go about doing that.
Tkinter is a python wrapper around tcl/tk's GUI toolkit , similar to how PySide/PyQt and wxPython are wrappers around the Qt and Wx C++ GUI toolkits.
If you wanted to build your own from scratch you would have to make use of existing operating system APIs and/or use something cross platform like OpenGL. For a good example of the latter you can look into Kivy, which is built on OpenGL
Different operating systems have different API's for doing GUI's. So how you have to do it very much depends on the operating system. I think one of the reasons that Python uses Tkinter is because it was already ported to different operating systems.
GUI API's are typically provided as shared libraries, often written in or compatible with C.
If you want to use those from Python, you will have to write a Python wrapper for them. For example using ctypes. Doing that requires a significant understanding of (1) Python, (2) ctypes and (3) the GUI API in question. If more than one of these technologies is new to you, I would not recommend taking on such a project.

Qt application interact with python 2.7

We have a large library and utility tools written in Python 2.7. And we need to create a GUI application that uses these python library and tools. So I'm looking for a solution that can easily interact between the GUI app and our python code base.
Requirements:
cross-platform: Linux, Windows;
these programming languages are preferred: C++, C#, Python.
Performance is not very essential. The key is to quickly develop the
GUI application;
I know that PyQt can be a good choice but what concerned me is - if we are to develop the GUI in Qt C++, interact with Python may not as easy as the other way round, i.e. python code can easily use Qt library because of PyQt but C++ code does not have something similar. When we have controls made in Qt C++, it would not be straightforward to use them in python.
Any suggestions? Thanks.

How is Python automating C++ Application?

I do automation and currently automating an application made with QT (C++).
I use Squish to do this using Python scripting language.
Can someone explain me exactly how a Python variable can be assigned a C++ Object?
Do you need to refer C++ built-in types (int, long, char, wchar_t, etc.) and arrays in Python code? If so you need to use ctypes Python package. Here is an example of calling C++ dll function from Python. If you need to send Window message (like WM_CLICK) take a look at ctypes.Structure class. There are some examples of C structures declared in Python code.
EDIT: Currently I know 2 open source projects about QT GUI automation.
funq
GammaRay
Also it's possible to build and run QT app with accessibility features for Windows UIA and Linux AT-SPI.

Python custom GUI

I googled and search stackoverflow before asking this question
Answers that I don't expect:
wxWidgets is the best Python GUIUse TkInter (BIM) for GUI development.
Q. How to make a GUI without using any module/library? i.e make a GUI from scratch. Modules like tkinter not allowed.
I've made several GUIs from scratch using SDL which is a low level drawing library. The advantage of doing that is that it will look exactly the same on any platform down to the pixel and you can get it to work on embedded systems. Full screen GUIs are really easy too. Disadvantages are that it is a lot of work.
In python the pygame library wraps SDL so you would use that, and in fact that is how I made the GUI for a lab instrument which had a large colour LCD screen. The controller ran linux, but not X-windows.
pygame is an extra library, yes, but I can't think of a way of making a GUI with only what python provides.
The easiest GUI to make without "module/library" is a web-based one. I.e. generate HTML with Javascript from your Python code, and let the Javascript interact via AJAX with your Python app. This can be implemented without too much effort with just the standard Python library (and some JS code, of course), or with modules that don't require "heavy" installation of platform-specific extensions.

Categories