cursesを試そう
30分プログラム、その638。cursesを試そう。
anarchy golf - Dancing KidsのDancingKidsがわりとかわいい。これをアニメーションにしたらおもしろいんじゃないかな、と思ったので、とりあえずcursesを調べてみた。
ソースコード
#! /usr/bin/python # -*- mode:python; coding:utf-8 -*- # # hello.py - # # Copyright(C) 2009 by mzp # Author: MIZUNO Hiroki / mzpppp at gmail dot com # http://howdyworld.org # # Timestamp: 2009/08/12 22:32:24 # # This program is free software; you can redistribute it and/or # modify it under MIT Lincence. # from curses import * stdscr = initscr() noecho() (h,w) = stdscr.getmaxyx() msg = 'Hello World' stdscr.addstr(h/2,w/2-len(msg)/2,msg,A_BOLD) while 1: c = stdscr.getch() if c == ord('q'): break