-
Notifications
You must be signed in to change notification settings - Fork 54
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
Questions regarding this project #6
Comments
The biggest problem for you would be that there is no rust library for Termux:GUI at the moment, so you would have to write that yourself. Have a look at the protocol and feel free to ask me if you have any questions. That also helps me to know if the protocol documentation is detailed enough for someone else to implement it. |
Thanks mate @tareksander :)
Is C at least supported? Because I know that Rust has C interop support. I also wanted to know what would I specifically have to do to get it to work with Termux GUI? |
Are there any chances that pygame would work with termuxgui? |
Not out-of-the-box, but it can in theory work with anything where you can access the pixel buffer. You can create a RGBA888 buffer in pygame and after drawing each frame you can copy the contents into a buffer that is shared with the plugin that then displays it. It's easier if the library supports drawing into an arbitrary buffer in memory, so you can instruct it to directly draw into the shared buffer. I also want to support sharing an GLES buffer in the future so the data doesn't have to be copied to and from graphics memory. There is a part in the python bindings tutorial that shows how to draw with a library and it uses python SDL bindings as an example. |
Thank you. :] |
Please, tell me what I'm doing wrong. I'm trying to add TabLayout. I have code like this But when I run it, it shows black screen. |
Do you have some sort of blocking or event loop after that code? I can't reproduce the black screen. My code is: import termuxgui as tg
import sys
with tg.Connection() as c:
a = tg.Activity(c)
tl = tg.TabLayout(a)
tl.setlist(["tab 1", "tab 2", "tab 3"])
for ev in c.events():
if ev.type == tg.Event.destroy and ev.value["finishing"]:
sys.exit()
print(ev.type, ev.value) |
I have not event loop, but when I tried your code, nothing has changed, I still have a black screen. UPD: it freezes after tl = tg.TabLayout(a) I tried restarting my phone and reinstalling the app, no effect |
Do things other than a TabLayout work? Are you sure you have version 0.1.4 of the app? The symptom of code after that not executing should be from the python code expecting an answer from the plugin, but the plugin doesn't answer because the command from the code is unknown. That should really only happen if the code uses a feature not present in the plugin. |
I'm sure, termux:gui is 0.1.4 version. LinearLayout, ImageView, Button, Horizontal and NestedScrollView, SwipeRefreshLayout, TextView and Buffer working normally. Jast checked, it can detect screen on/off events, presented in 0.1.4 |
Can you upload the output of |
So, any ideas? Please) |
You can try the following script, which runs the event loop in a separate thread. If you see an event printed with "invalidMethod", that means a feature (in this case setlist for TabLayout) isn't present in the plugin, which should really only occur when the plugin is outdated. import termuxgui as tg
import threading
import sys
with tg.Connection() as c:
def evloop():
for ev in c.events():
print(ev.type, ev.value)
threading.Thread(target=evloop).start()
a = tg.Activity(c)
tl = tg.TabLayout(a)
tl.setlist(["tab 1", "tab 2", "tab 3"]) |
What Android version do you have? When you quit the python script with ctrl + c, there should be a stack trace, can I see that? |
The code for TabLayout is there in 0.1.4 and there were no Exceptions in the logcat... I started a build from the latest source, maybe the problem is already fixed. |
Thanks a lot, now it is working! |
You need an event loop or wait with time.sleep() so the activity doesn't end, see the Python tutorial. Also the color format is RGBA (as a number and not a string), so 0xaabbggrr. |
It ended even if there was an event loop. But after applying the correct color format, everything works as it should. Thank you, thank you very much |
Hello |
It should work if you allow proot to keep /data/data/com.termux mounted and keep the PATH. It only needs to access the am binary from the termux environment in PATH. Should work in proot-distro by default. |
By default this doesnt work. When I'm trying import module, rises ModuleNotFoundError, after installing module, rises RuntimeError: Plugin doesn't have the same UID. |
The uid error is because proot emulates a root user. Try getting the uid used by termux and set proot to use that. |
@Raj2032 The C library is now mostly done: https://github.com/tareksander/termux-gui-c-bindings |
Hi, I have some questions regarding this project.
conrod
oriced
GUI library. Is it easily portable totermux-gui
?termux-gui
) would I be able to scroll using the touch screen?The text was updated successfully, but these errors were encountered: