Taichi: Interface legacy C++ GUI Widget system with Python

Created on 16 Feb 2020  路  6Comments  路  Source: taichi-dev/taichi

Concisely describe the proposed feature
As mentioned in https://github.com/taichi-dev/taichi/pull/478 we do have an old yet helpful C++ widget system that supports sliders, buttons, etc:

Screenshot from 2020-02-16 16-54-13

(How to run it: just use the latest commit, clone taichi_assets as taichi/assets, and execute ti test_gui)

Since literally nobody is using Taichi via C++ anymore, we should consider adding a Python binding via pybind11, potentially extending ti.GUI.

(Why don't we use Qt: Taichi used to depend on Qt, yet a lot of users had problems installing it, even PyQt... Also the types of widgets we need to support is rather minimal and Qt is an overkill.)

feature request stale welcome contribution

All 6 comments

The old C++ widget system is good, but most people just using python now. I think pip users won't like the code never reached in libtaichi_core.so :)

Solution 1:
Add python bindings to these widget class. Further developments will be in C++.
Solution 2:
Move the widget system completely written python, just leaving font rendering & lower event system in C++, since GUI is not performance sensitive and python is easy to develop.
We can add more widgets, features in python without compile. Note that we are making a programming language. Language compiled libraries should be low-level enough, high-level things can be moved out of libtaichi_core.so.
Also because I see slider & button aren't dep on win32 hwnd.

How do you think? I personally tend to solution 2.

Btw, why not taichi-dev/taichi_assets?

My feeling is that we should first go 1 since it's not a lot of work (just export a few functions and callbacks). 2 sounds like more work but also more extensible. The question is as a compiler do we really need a super fancy widget system? My feeling tends to be no, but I'm open to any inputs.

Btw, why not taichi-dev/taichi_assets?

Currently the only file we need in that submodule is a font file (fonts/Go-Regular.ttf).

My feeling is that we should first go 1 since it's not a lot of work (just export a few functions and callbacks). 2 sounds like more work but also more extensible. The question is as a compiler do we really need a super fancy widget system? My feeling tends to be no, but I'm open to any inputs.

You're right. the GUI system isn't a center point of a compiler.

Currently the only file we need in that submodule is a font file (fonts/Go-Regular.ttf).

Yeah I made a symbolic link from /usr/share/fonts and it works :)

Warning: The issue has been out-of-update for 50 days, marking stale.

People might be happy if they could use this in their TopOp build on taichi.py, working on this now :)

People might be happy if they could use this in their TopOp build on taichi.py, working on this now :)

That would be very helpful! But again, I suggest we go with your "Solution 1": simply add python bindings of existing C++ widget classes.

Was this page helpful?
0 / 5 - 0 ratings