-
Notifications
You must be signed in to change notification settings - Fork 59
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
Windows compatibility and example apps #129
Comments
Could you give some more details on your configuration? Mouse support should work on the latest versions, so it's either an outdated terminal or outdated PTG install. Thanks for trying it out! |
I should mention that this is Windows 10 using its default PowerShell console. PTG version whatever was pulled in via |
This issue isn't limited to example code, it's the issue with library itself. I've made another code and it works completely fine as expected in Linux, but the input boxes and buttons are unclickable in windows. I've installed cygwin for windows and it works in that, I think it should work in WSL as well. But I think native windows consoles (CMD Prompt, Powershell) support needs to be fixed. I've not changed anything with configuration of powershell/cmd prompt, they're stock ones that comes with windows by default |
yes i Yes, I also had the same problem. |
A breaking change happened between 7.4 and 7.5. Interestingly, there is an entirely different mouse error when the terminal is conhost.exe (windows console host - the legacy NT console) than with wt.exe (window terminal app). import pytermgui as ptg
ptg.inline(ptg.Button("Quit", lambda *_: print("Pressed"))) windows terminal:
conhost
This is run with the same code, in the same venv - python 3.12.0, PyTermGUI==7.7.0 |
Unfortunately I do not have a Windows machine to trial things on so I can't really know what's going on. @Tired-Fox implemented mouse support for Windows some time ago, and I just now fixed a bug with @tritium21's example shows that Windows Shell seems to properly support ANSI mouse reporting, while conhost does not, even with our driver. Unfortunately that is as far as I can diagnose in my current state :) |
@bczsalba FWIW anyone who wants a TUI on windows probably is running windows shell and not conhost anyways. |
That's been my assumption too, but you never know :) To answer the original issue, @ouroborus:
Should be up to the terminal emulator at this point, and Windows Terminal should work.
Arrow keys should also work. In case they don't, could you show me the output of pressing the arrow keys while running
Going to try to fix this now :) (✔️)
Since the quit button is in a separate window (the footer), focus doesn't transfer to it with the normal methods. You can bind some form of focus manipulation through a function: manager.bind(<some key>, lambda *_: manager.focus_next())
manager.bind(<some other key>, lambda *_: manager.focus_next(-1)) ...but a native solution isn't impossible either. I'm not a huge fan of adding something like this though, as focus should be tied to a window, not something to freely flow between different ones. I agree from a UX perspective that button should be focusable some other way though! |
It doesn't work, I've tried with windows terminal(if this means command prompt) & powershell as well. Mouse doesn't work at all.
The output of ptg -g is different from what I get by running it in linux. In windows this didn't even ask me for input and printed some random text. Here's the paste of what came out - https://katb.in/helukukerad Let me know what can I do to further help you debugging this. |
Windows Terminal is the console application that has a tab bar across the top. the other option is If you are running powershell or cmd.exe inside of these doesn't matter to the terminal - its the terminal, not the shell, that makes rendering decisions. Windows Terminal (the first image, available from the microsoft store or through winget) is what |
I see, that solves it. I installed Windows Terminal and ran my code on it. Mouse works fine but the arrow keys doesn't work, hjkl works but I won't consider them proper replacement since if an inputbox is active, the hjkl keys type letters instead of selecting other elements. For arrow keys, ptg -g doesn't work the same way it does in linux, like mentioned in #133, and backspace in input field doesn't work as well. |
update: That seems to have somewhat fixed arrow keys and has completely fixed backspace. But when in input field, the up and down keys dont select next element, but instead inputs H and P resp., left and right arrow keys work fine in input boxes Also the change seems to break mouse, the buttons and input boxes are unclickable, they start working again if I revert the change |
I'm trying PyTermGUI for the first time by using the example at
examples\simple_app.py
on Windows.The text was updated successfully, but these errors were encountered: