Last active
May 9, 2018 15:25
-
-
Save tsukkee/95aa071203eccb8656837887aac8f6c3 to your computer and use it in GitHub Desktop.
cursesでKEY_RESIZEがとれているかだけを見るプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gcc curses_test.c -o curses_test -lncurses