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
Fix issues with running Python's curses module on Windows #6978
Comments
CC @carlescufi |
Does this mean that, for the time being, we need to maintain a fork of both PDCurses and also the wheel itself? This seems a bit onerous. Once you have it working with curses it would be really good to see how much work it is to use a native Python module to achieve the same. Depending on the effort required we can then take a decision at the TSC level on this matter. |
I updated the wheels for curses yesterday. Please try them. |
@cgohlke thanks for chiming in and for the updated wheel. Is there a chance this will ever live in a Git (GitHub or elsewhere) repo complete with the necessary files to actually rebuild the wheel? We're a bit weary of relying on a package whose sources don't seem to contain the build files (Makefiles or anything else required). |
@cgohlke Since you're here, I solved the resizing issue by calling No new if (!SP->resized)
{
SP->resized = TRUE;
return KEY_RESIZE;
} Have you thought of enabling some of the @carlescufi
I patched |
I enabled all possible features: define_macros = [
('PDC_WIDE', None),
('HAVE_NCURSESW', None),
('HAVE_TERM_H', None),
('HAVE_CURSES_IS_TERM_RESIZED', None),
('HAVE_CURSES_RESIZETERM', None),
('HAVE_CURSES_TYPEAHEAD', None),
('HAVE_CURSES_HAS_KEY', None),
('HAVE_CURSES_FILTER', None),
('HAVE_CURSES_WCHGAT', None),
('HAVE_CURSES_USE_ENV', None),
('WINDOW_HAS_FLAGS', None),
('NCURSES_MOUSE_VERSION', 2),
('_ISPAD', 0x10),
('is_term_resized', 'is_termresized'),
('resizeterm', 'resize_term'),
] On Python >= 3.5, unicode should now work. |
@cgohlke For ncurses-compatible behavior for |
To clarify the issue: Calling |
Tried out the most recent I debugged an issue related to Even with that, calling Pretty sure I can get that debugged as well, but I wonder if I should spend time on it now or later. Besides resizing, the Edit: Just to clarify: You don't get a segfault when resizing on Windows unless you try to implement proper resizing, which requires calling |
@cgohlke There's just one compatibility issue I noticed: ncurses' while True:
c = win.get_wch()
if c == curses.KEY_RESIZE:
curses.resizeterm(*stdscr.getmaxyx())
elif c == ... Instead of binding PDCurses' Those functions seem closer in spirit too, as PDCurses is more manual when it comes to dealing with resizing. The implementations of |
I made those changes. How about using PDCurses' |
@cgohlke Looks like it's safe. ncurses resizes the terminal automatically inside The ncurses author mentions the |
As part of #5847, I'm looking into getting the standard Python curses module running on Windows via the Python wheels provided on https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses, which seem to be widely used.
The wheels mostly work fine, with the biggest issue being broken support for terminal resizing in the windows console. I've rebuilt them and found the issue, and will do a write-up (including build instructions) and email the wheel author later.
I also submitted a related issue to the PDCurses GitHub page. PDCurses is the curses implementation used by the wheels.
The text was updated successfully, but these errors were encountered: