Skip to content

Instantly share code, notes, and snippets.

@tsukkee
Last active May 9, 2018 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsukkee/95aa071203eccb8656837887aac8f6c3 to your computer and use it in GitHub Desktop.
Save tsukkee/95aa071203eccb8656837887aac8f6c3 to your computer and use it in GitHub Desktop.
cursesでKEY_RESIZEがとれているかだけを見るプログラム
#include <stdlib.h>
#include <stdio.h>
#include <curses.h>
int main() {
WINDOW* mainwin;
if ((mainwin = initscr()) == NULL) {
fprintf(stderr, "Error initialsing ncurses.\n");
exit(EXIT_FAILURE);
}
for(;;) {
int c = getch();
if (c == KEY_RESIZE) {
addch('!');
}
}
delwin(mainwin);
endwin();
refresh();
return EXIT_SUCCESS;
}
import curses
def main(stdscr):
stdscr.clear()
while True:
key = stdscr.getch()
if key == curses.KEY_RESIZE:
stdscr.addch('!')
stdscr.refresh()
if __name__ == '__main__':
curses.wrapper(main)
@tsukkee
Copy link
Author

tsukkee commented May 9, 2018

gcc curses_test.c -o curses_test -lncurses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment