I'm trying to make a python GUI application that handles some sort of data. Then I expect to make the user capable of manipulating that data using python scripts, form within the GUI, using a script interpreter with the data exposed as pre-existing objects. Pretty much like VBA is embedded in MSWord or the way you can embed python on a C application (see here).
Is there any technique or library to do this?
Has this been achieved in some project before?
One way to do it would be to write a GUI in PyQt, and then embed an iPython console inside the GUI as a GUI widget.
Check out this answer:
Embedding IPython Qt console in a PyQt application
and a couple other suggestions here:
https://github.com/ipython/ipython/issues/9508
A different non-PyQt approach is described here:
https://www.pythoncentral.io/embed-interactive-python-interpreter-console/
Related
Is there any way to user autocomplete in embarcadero PyScripter or PyChamr?
I really want to write python scripts using the delphivlc library, but it's real hard when I can't use autocomplete.
And...
Do you people know why GUI interface stop responding when moving files using python?
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.
My company has a C/C++ application developed using Visual Studio. Currently we have a Visual Basic plugin which lets you open a built-in text editor and run VB code. This built-in text editor gives the user all the basic debugging tools (break, watch, step...). I was wondering how could I do that using Python. The tricky part is that the python interpreter has to be launched from inside the main application, so that they have access to the same memory space.
I already have a swig interface for the application API and did a proof of concept VB script in which I loaded Python as a DLL and executed a script as described here. This works perfectly when I am sure the script has no bugs, but it would be much easier if I could have some sort of interface which I can debug the script being executed.
I had a look into the pdb module, but it dosent look like the way to go. If someone could just point me into the right direction it would be much appreciated.
I've had some luck embedding Spyder in a C/C++ program that I had created wrappers for (using PySide). Since the wrappers included the main application logic, I turned the program into a python application and then embedded Spyder using one of their examples.
However, it uses pdb or winpdb under the hood, so complete functionality is still not there IMHO.
Im new to python and want to create a GUI front-end (desktop, rather than web) for my python script. The script essentially parses XML files and runs various searches over the contents (eg. accepts regex searches from the user, returns results etc).
It works well on the command line but I want to present a more user friendly interface.
There seems to be a lot of options out there - http://docs.python.org/faq/gui.html
Or should I look elsewhere?
Can someone recommend a GUI toolkit for Python?
Cheers.
I recommend using one of Tkinter, wxPython or PyQt. They are all equally suitable for a simple task. My personal favorite is Tkinter because I think it is the simplest way to get started. However, any of those would make a fine choice.
Here is a page on the Python wiki with some fifty options.
PyQt is great, although it's on GPL. There is also PySide alternative on LGPL.
You can also try wxPython or PyGTK if you don't like Qt for some reason. There is also gui library in python standard library called Tkinter, but I haven't used it and don't have any experience with it.
Is it possible to embed a 3-D editor inside my wxPython application? (I'm thinking Blender, but other suggestions are welcome.)
My application opens a wxPython window, and I want to have a 3-D editor inside of it. Of course, I want my program and the 3-D editor to interact with each other.
Possible? How?
Blender has python plugins, you can write a plugin to interract with your program.
I second Luper Rouch's idea of Blender plugins. But if you must have your own window you need to fork Blender. Take a look at makehuman project. It used to have Blender as a platform. (I'm not sure but I think they have a different infrastructure now)
For Blender specifically, I doubt it. Blender uses a custom UI based on OpenGL, and I'm not sure you can force it to use a pre-existing window. I suggest browsing the code of "Ghost", which is Blender's custom adaption layer (responsible for interacting with the OS for UI purposes).
Perhaps this script might provide some context for your project. It integrates Blender, ActiveX, and wxPython.
Caveat: Windows only.
For Blender2.5 on linux you can use gtk.Socket, code example is here on pastebin