commit a292efafe860968f482081a83b0b2ec1a6096ed3 Author: suti7yk5032 Date: Sun May 12 21:59:13 2024 +0900 1st diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42b415e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/venv/ +/*.lnk \ No newline at end of file diff --git a/joke.py b/joke.py new file mode 100644 index 0000000..25846a5 --- /dev/null +++ b/joke.py @@ -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() + diff --git a/source/chigaimasu.jpeg.png b/source/chigaimasu.jpeg.png new file mode 100644 index 0000000..24d9f34 Binary files /dev/null and b/source/chigaimasu.jpeg.png differ diff --git a/source/gomennasai.jpeg.png b/source/gomennasai.jpeg.png new file mode 100644 index 0000000..c4f10ea Binary files /dev/null and b/source/gomennasai.jpeg.png differ diff --git a/source/jojaku.jpeg.png b/source/jojaku.jpeg.png new file mode 100644 index 0000000..de810e0 Binary files /dev/null and b/source/jojaku.jpeg.png differ diff --git a/source/lolicon.jpeg.png b/source/lolicon.jpeg.png new file mode 100644 index 0000000..ffe97c5 Binary files /dev/null and b/source/lolicon.jpeg.png differ diff --git a/source/mazuidesuyo.jpeg.png b/source/mazuidesuyo.jpeg.png new file mode 100644 index 0000000..26e9b7f Binary files /dev/null and b/source/mazuidesuyo.jpeg.png differ diff --git a/source/not_bad.jpeg.png b/source/not_bad.jpeg.png new file mode 100644 index 0000000..c6c70e4 Binary files /dev/null and b/source/not_bad.jpeg.png differ diff --git a/source/not_funny.jpeg.png b/source/not_funny.jpeg.png new file mode 100644 index 0000000..ac87c71 Binary files /dev/null and b/source/not_funny.jpeg.png differ diff --git a/source/ooo.jpeg.png b/source/ooo.jpeg.png new file mode 100644 index 0000000..52f8d55 Binary files /dev/null and b/source/ooo.jpeg.png differ diff --git a/source/sensitive.jpeg.png b/source/sensitive.jpeg.png new file mode 100644 index 0000000..b9361d6 Binary files /dev/null and b/source/sensitive.jpeg.png differ diff --git a/source/sikuzitta.jpeg.png b/source/sikuzitta.jpeg.png new file mode 100644 index 0000000..6ba2e34 Binary files /dev/null and b/source/sikuzitta.jpeg.png differ diff --git a/source/siscon.jpeg.png b/source/siscon.jpeg.png new file mode 100644 index 0000000..e9ce7e6 Binary files /dev/null and b/source/siscon.jpeg.png differ diff --git a/source/tasukarui.jpeg.png b/source/tasukarui.jpeg.png new file mode 100644 index 0000000..9d6259c Binary files /dev/null and b/source/tasukarui.jpeg.png differ