7
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コウメさんと一緒に「チクショー」を鳴らそう。

7
Posted at

1.はじめに

仕事で疲れていました。

仕様変更、レビュー、謎の会議、終わらないExcel。
気づいたら脳が何も考えたくなくなっていました。

そんなときふと思いました。

「ボタンを押したら『チクショー』と鳴るだけのアプリがあれば、少しは気が晴れるのでは?」

本記事では、仕事に疲れたエンジニアが、Pythonで「コウメさんのチクショー」を流すだけのどうしようもないアプリを本気で作るまでの記録を書きます。

image.png

2. 「チクショー」アプリケーション

■ 要求
要求としては、すぐに「チクショー」を発動できるアプリにする。また、駆動OSはWindows上を想定。

■ コーディング
コウメを召喚するために以下のソースコードを練りこみます。
koume.mp3は、提供したかったんですけど無理でした😇
私は以下のソースコードをもとに、pyinstallerを利用してexe化しました。
これで、いつでもコウメを召喚できるようになりました(笑)

コウメ
import pygame
import time
import os

mp3_path = os.path.join(
    os.getcwd(),
    "koume.mp3"
)

pygame.mixer.init()
pygame.mixer.music.load(mp3_path)
pygame.mixer.music.play()

while pygame.mixer.music.get_busy():
    time.sleep(0.1)

3.結果

完成したアプリは以下になります。
image.png

画像ではわかりにくいので、実際に動画をXに投稿したので、見ていただければ幸いです。

4.おわりに

感想は一言。あ~すっきりした。

7
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?