Fork me on GitHub

2008/06/11

Recent entries from same category

  1. Lingr Radar For Linuxってのを書いた Hatena
  2. デスクトップアプリケーションでも認証可能なOAuth「xAuth」をpythonから試してみた。 Hatena
  3. Mumblesを使ったGitHubのGrowl通知アプリケーションを作った。 Hatena
  4. Python2.6にはcursesのバイナリが含まれていないので作る Hatena
  5. 無料ではてなブックマークとdeliciousを同期する方法 Hatena

このエントリーをはてなブックマークに追加
これだけメソッドがあれば大概の事は出来る。
The Console Module

The Console module provides a simple console interface, which provides cursor-addressable text output, plus support for keyboard and mouse input.

The Console module is currently only available for Windows 95, 98, NT, and 2000. It probably works under Windows XP, but it hasn’t been tested on that platform.

試しに作ってみた。以下ソース

Oppai.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, time, codecs
import Console

class Oppai:
  def __init__(self):
    self.nest = 1

  def __getattr__(self, name):
    if name == 'Oppai':
      self.nest += 1
      return self
    else:
      return self.__dict__[name]

  def __call__(self):
    aa = [u"""
    _  ∩
  ( ゜∀゜)彡 おっぱい!おっぱい!
  (  ⊂彡
   |   | 
   し ⌒J
""", u"""
    _  ∩
  ( ゜∀゜)彡 おっぱい!
  (    | 
   |   | 
   し ⌒J
""", u"""
    _  
  ( ゜∀゜)  おっぱい!
  (  ⊂彡
   |   | 
   し ⌒J
"""]

    c = Console.getconsole()
    c.title("Oppai")
    for n in range(self.nest * 4):
      c.page()
      oppai = aa[n % 4 in (0, 2) and (n % 4)/2+1 or 0]
      l = 0
      for line in oppai.split("\n"):
        c.text(0, l, line.encode("mbcs"))
        l += 1
      time.sleep((n % 4) in (0, 2) and 0.5 or 0.15)
Oppai = Oppai()

if __name__ == '__main__':
  Oppai.Oppai.Oppai.Oppai()
使い方は
import Oppai

Oppai.Oppai.Oppai.Oppai()
こんな感じ。動かすと属性参照した分だけ、おっぱいアニメーションが流れます。
おっぱいそん
簡単ですね!
Posted at 13:43 in ソフトウェア::lang::python | Edit
Tagged as: console, oppai, python
Bookmarks: add to hatena add to hatena | add to delicious.com | add to livedoor.clip add to livedoor.clip

blog comments powered by Disqus