Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Oh, I love Dear Imgui -- it's very simple to use and has a nice... "engineering"/scientific aesthetic. Good to hear it's been ported to python.

If you're looking for an end-user product, this may not give you the control you're looking for. But if you're looking for a dead-simple way to create a quick GUI for a side project, this is perfect.



The underlying "imgui" https://github.com/ocornut/imgui project:

From the github page - EDIT: Read the bindings / frameworks page too, https://github.com/ocornut/imgui/wiki/Bindings It's still c++ like.

"""

Officially maintained bindings (in repository):

Renderers: DirectX9, DirectX10, DirectX11, DirectX12, OpenGL (legacy), OpenGL3/ES/ES2 (modern), Vulkan, Metal.

Platforms: GLFW, SDL2, Win32, Glut, OSX.

Frameworks: Emscripten, Allegro5, Marmalade.

Third-party bindings (see Bindings page):

Languages: C, C# and: Beef, ChaiScript, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift...

Frameworks: AGS/Adventure Game Studio, Amethyst, bsf, Cinder, Cocos2d-x, Diligent Engine, Flexium, GML/Game Maker Studio2, Godot, GTK3+OpenGL3, Irrlicht Engine, LÖVE+LUA, Magnum, NanoRT, Nim Game Lib, Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, SFML, Sokol, Unity, Unreal Engine 4, vtk, Win32 GDI, WxWidgets.

Note that C bindings (cimgui) are auto-generated, you can use its json/lua output to generate bindings for other languages.

"""


> Note that C bindings (cimgui) are auto-generated, you can use its json/lua output to generate bindings for other languages.

note about this. the C++ imgui library uses stuff like out-arguments (pass a pointer that gets filled out with a result) almost everywhere, which makes wrapping it with a pointer-less language non-trivial – in python, you want an interface that just returns a tuple and you'll have to code that part up manually anyway (or come up with a really clever generator)

[source: i've contributed to pyimgui, another imgui wrapper, and we looked at auto-generating wrappers at some point, but decided against it because of how much work you'd have to do on top to make it "pythonic". i think they're looking at that again now though.]


SWIG can sometimes help with this.


What's your recommendation for a Python-engineered end-user product?


Native, if cross-plattform then Qt or wx (only "old" widgets).


A semi-related question; what is the current 'correct way' to package up Python projects and all their dependencies as native executables for Windows/OSX/Linux? I haven't done any desktop Python since 2.5 and then it was a fiddly process of 'freezing' exe's, is that still the recommended way with Python 3?


It sounds cynical, but I've found that porting Python code to C++ and using Qt is much less headache than trying to make a clean Python "app" that can be run by non-technical users. However a simple solution is to distribute a local copy of Python with all the packages pre-installed. That's not as clean as a single exe, but generally you're going to need DLLs or whatever anyway, and to the end user, running a bat file that calls Python hides most of the mess. The bigger problem with that is hiding code, if you need to do that, but you can always distribute pyc files on their own.

This may have changed, but the last time I tried freezing it took a lot of massaging to get it to work reliably. So I've always opted to just ship a complete python env. I've seen big commercial products do the same when they need to provide python support - you may have experienced this when some new install accidentally adds a new python interpreter to your PATH.


I use pyinstaller to build windows executables directly from Linux using this docker image: https://github.com/cdrx/docker-pyinstaller

Between Qt and Python there is a huge amount of cross platform support. For example, I found out that Qt supports bluetooth, which currently has no other cross platform support in python (the unmaintained pybluez has all sorts of issues).


This is a fairly comprehensive build system for gui apps in python, I think: https://build-system.fman.io/


I've had good luck with https://www.pyinstaller.org/ and Qt in python.


That's still the way to go, and it's still fiddly and always requires manual tweaking until it works. Especially on Linux. Deploying binaries on Linux is just always a hassle, and never works "everywhere"...


Pretty much the same, though it was never that difficult. There is also PyOxidizer, and zipapp is an option for some.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: