Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface legacy C++ GUI Widget system with Python #484

Closed
yuanming-hu opened this issue Feb 16, 2020 · 6 comments · Fixed by #1490
Closed

Interface legacy C++ GUI Widget system with Python #484

yuanming-hu opened this issue Feb 16, 2020 · 6 comments · Fixed by #1490
Assignees
Labels
feature request Suggest an idea on this project stale stale issues and PRs welcome contribution

Comments

@yuanming-hu
Copy link
Member

yuanming-hu commented Feb 16, 2020

Concisely describe the proposed feature
As mentioned in #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.)

@archibate
Copy link
Collaborator

archibate commented Feb 17, 2020

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?

@yuanming-hu
Copy link
Member Author

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).

@archibate
Copy link
Collaborator

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 :)

@github-actions
Copy link

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

@github-actions github-actions bot added the stale stale issues and PRs label May 21, 2020
@archibate archibate self-assigned this Jul 13, 2020
@archibate
Copy link
Collaborator

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

@yuanming-hu
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Suggest an idea on this project stale stale issues and PRs welcome contribution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants