This commit is contained in:
suti7yk5032 2024-05-12 21:59:13 +09:00
commit a292efafe8
14 changed files with 144 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/venv/
/*.lnk

142
joke.py Normal file
View file

@ -0,0 +1,142 @@
import tkinter as tk
import threading
import time
from PIL import Image, ImageTk
import glob
import random
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title("メインウィンドウ")
self.geometry("200x400")
self.resizable(height=False, width=False)
self.grid_rowconfigure(13, weight=1)
self.grid_columnconfigure(0, weight=1)
self.button_width = 160
self.o_button = tk.Button(self, text="おぉ///", width=self.button_width, command=self.ooo)
self.o_button.grid(row=0, column=0)
self.sensitive_button = tk.Button(self, text="センシティブ", width=self.button_width, command=self.sensitive)
self.sensitive_button.grid(row=1, column=0)
self.gomennasai_button = tk.Button(self, text="ごめんなさい", width=self.button_width, command=self.gomennasai)
self.gomennasai_button.grid(row=2, column=0)
self.jojaku_button = tk.Button(self, text="じょうじゃく", width=self.button_width, command=self.jojaku)
self.jojaku_button.grid(row=3, column=0)
self.lolicon_button = tk.Button(self, text="ロリコン", width=self.button_width, command=self.lolicon)
self.lolicon_button.grid(row=4, column=0)
self.mazuidesuyo_button = tk.Button(self, text="まずいですよ", width=self.button_width, command=self.mazuidesuyo)
self.mazuidesuyo_button.grid(row=5, column=0)
self.warukunai_button = tk.Button(self, text="わるくない", width=self.button_width, command=self.warukunai)
self.warukunai_button.grid(row=6, column=0)
self.omonna_button = tk.Button(self, text="おもんな", width=self.button_width, command=self.omonna)
self.omonna_button.grid(row=7, column=0)
self.sikuzitta_button = tk.Button(self, text="しくじった", width=self.button_width, command=self.sikuzitta)
self.sikuzitta_button.grid(row=8, column=0)
self.siscon_button = tk.Button(self, text="シスコン", width=self.button_width, command=self.siscon)
self.siscon_button.grid(row=9, column=0)
self.tasukarui_button = tk.Button(self, text="たすかるい", width=self.button_width, command=self.tasukarui)
self.tasukarui_button.grid(row=10, column=0)
self.random_button = tk.Button(self, text="ランダム", width=self.button_width, command=self.random)
self.random_button.grid(row=11, column=0)
def ooo(self):
OApp("ooo.jpeg.png")
def sensitive(self):
OApp("sensitive.jpeg.png")
def gomennasai(self):
OApp("gomennasai.jpeg.png")
def jojaku(self):
OApp("jojaku.jpeg.png")
def lolicon(self):
OApp("lolicon.jpeg.png")
def mazuidesuyo(self):
OApp("mazuidesuyo.jpeg.png")
def warukunai(self):
OApp("not_bad.jpeg.png")
def omonna(self):
OApp("not_funny.jpeg.png")
def sikuzitta(self):
OApp("sikuzitta.jpeg.png")
def siscon(self):
OApp("siscon.jpeg.png")
def tasukarui(self):
OApp("tasukarui.jpeg.png")
def random(self):
img_files = glob.glob("./source/*")
for ib in range(3):
for ia in range(12):
OApp_move(img_files[ia].replace("./source", ""), random.randint(0, 1900), random.randint(0, 1200))
time.sleep(0.3)
class OApp(tk.Toplevel):
def __init__(self, image_path):
super().__init__()
self.img_path = "./source/" + image_path
self.stmp = Image.open(self.img_path)
self.title(self.img_path)
self.geometry(str(self.stmp.width) + "x" + str(self.stmp.height))
self.resizable(height=False, width=False)
self.imageiscanva = tk.Canvas(self, width=self.stmp.width, height=self.stmp.height)
self.imageiscanva.pack()
self.canva_width = self.imageiscanva.winfo_width()
self.canva_height = self.imageiscanva.winfo_height()
self.stmp_img = ImageTk.PhotoImage(self.stmp)
self.imageiscanva.create_image(self.canva_width / 2 , self.canva_height / 2, image=self.stmp_img, anchor=tk.NW)
class OApp_move(tk.Toplevel):
def __init__(self, image_path, mw, mh):
super().__init__()
self.img_path = "./source/" + image_path
self.stmp = Image.open(self.img_path)
self.title(self.img_path)
self.geometry(str(self.stmp.width) + "x" + str(self.stmp.height) + "+" + str(mw) + "+" + str(mh))
self.resizable(height=False, width=False)
self.imageiscanva = tk.Canvas(self, width=self.stmp.width, height=self.stmp.height)
self.imageiscanva.pack()
self.canva_width = self.imageiscanva.winfo_width()
self.canva_height = self.imageiscanva.winfo_height()
self.stmp_img = ImageTk.PhotoImage(self.stmp)
self.imageiscanva.create_image(self.canva_width / 2 , self.canva_height / 2, image=self.stmp_img, anchor=tk.NW)
if __name__ == "__main__":
app = App()
app.mainloop()

BIN
source/chigaimasu.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
source/gomennasai.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
source/jojaku.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

BIN
source/lolicon.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
source/mazuidesuyo.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
source/not_bad.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
source/not_funny.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

BIN
source/ooo.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

BIN
source/sensitive.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
source/sikuzitta.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

BIN
source/siscon.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

BIN
source/tasukarui.jpeg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB