LoginSignup
0
1

More than 3 years have passed since last update.

ビンゴ

Last updated at Posted at 2019-07-05

乱数を使うことがあったので暇つぶしにビンゴマシーンを作ってみました。

import tkinter as tk
import numpy as np
import bisect

bingo = list(range(1,76))
gets = []

def bingoo():
        get = np.random.choice(bingo)
        bisect.insort_left(gets,get)
        s= "最新番号: {0} ".format(get)
        labelResult['text'] = s
        m = "今までの数 {0} ".format(gets)
        labelLesult['text'] = m
        bingo.remove(get)
        if len(bingo) ==0:
            s = "終了"
            labelResult['text'] = s

win = tk.Tk()
win.title("ビンゴ")
win.geometry("500x250")
labelResult = tk.Label(win, text=u'---',font=("",50))
labelResult.pack()
labelLesult = tk.Label(win, text=u'---')
labelLesult.pack()
calcButton = tk.Button(win, text=u'次の数は・・・')
calcButton["command"] = bingoo
calcButton.pack()
win.mainloop()
0
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
0
1