Mahalitoのブログ

少女ロマンス・スプリングをよろしくお願いします

#coding:utf-8

import random as r

import tkinter as tk

from PIL import Image,ImageTk

root=tk.Tk()

canvas=tk.Canvas(root,width=200,height=200,bg="white")

canvas.pack()

dice=r.randint(1,6)

if dice==1:

    img=Image.open("sai1.png")

elif dice==2:

    img=Image.open("sai2.png")

elif dice==3:

    img=Image.open("sai3.png")

elif dice==4:

    img=Image.open("sai4.png")

elif dice==5:

    img=Image.open("sai5.png")

else:

    img=Image.open("sai6.png")

tkimg=ImageTk.PhotoImage(img)

canvas.create_image(100,100,image=tkimg)

root.mainloop()