Skip to content

Instantly share code, notes, and snippets.

@tsukkee
Last active May 9, 2018 15:25
Embed
What would you like to do?
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