This commit is contained in:
suti7yk5032 2024-05-12 21:47:43 +09:00
commit 7816b289a3
9 changed files with 796 additions and 0 deletions

2
.gitignore vendored Normal file
View file

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

57
copyright.txt Normal file
View file

@ -0,0 +1,57 @@
pillow
The Python Imaging Library (PIL) is
Copyright © 1997-2011 by Secret Labs AB
Copyright © 1995-2011 by Fredrik Lundh
Pillow is the friendly PIL fork. It is
Copyright © 2010-2023 by Jeffrey A. Clark (Alex) and contributors.
Like PIL, Pillow is licensed under the open source HPND License:
By obtaining, using, and/or copying this software and/or its associated
documentation, you agree that you have read, understood, and will comply
with the following terms and conditions:
Permission to use, copy, modify and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appears in all copies, and that
both that copyright notice and this permission notice appear in supporting
documentation, and that the name of Secret Labs AB or the author not be
used in advertising or publicity pertaining to distribution of the software
without specific, written prior permission.
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
darkdetect
Copyright (c) 2019, Alberto Sottile
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of "darkdetect" nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL "Alberto Sottile" BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

57
docs/copyright.txt Normal file
View file

@ -0,0 +1,57 @@
pillow
The Python Imaging Library (PIL) is
Copyright © 1997-2011 by Secret Labs AB
Copyright © 1995-2011 by Fredrik Lundh
Pillow is the friendly PIL fork. It is
Copyright © 2010-2023 by Jeffrey A. Clark (Alex) and contributors.
Like PIL, Pillow is licensed under the open source HPND License:
By obtaining, using, and/or copying this software and/or its associated
documentation, you agree that you have read, understood, and will comply
with the following terms and conditions:
Permission to use, copy, modify and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appears in all copies, and that
both that copyright notice and this permission notice appear in supporting
documentation, and that the name of Secret Labs AB or the author not be
used in advertising or publicity pertaining to distribution of the software
without specific, written prior permission.
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
darkdetect
Copyright (c) 2019, Alberto Sottile
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of "darkdetect" nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL "Alberto Sottile" BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

161
en.py Normal file
View file

@ -0,0 +1,161 @@
import customtkinter
import os
from PIL import Image
from winotify import Notification, audio
from plyer import notification
version = "0.1"
builddate = "2023/4/27"
class App(customtkinter.CTk):
def __init__(self):
super().__init__()
self.title("which_my_toast")
self.geometry("786x380")
self.resizable(height=False, width=False)
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(1, weight=1)
image_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "lib")
self.logo = customtkinter.CTkImage(Image.open(os.path.join(image_path, "logo.png")), size=(59, 54))
self.title_font = customtkinter.CTkFont(family="meiryo", size=20, weight="bold")
self.info_font = customtkinter.CTkFont(family="meiryo", size=14)
self.frame = customtkinter.CTkFrame(self, corner_radius=0)
self.frame.grid(row=0, column=0, sticky="nsew")
self.frame.grid_columnconfigure(4, weight=1)
self.frame_label = customtkinter.CTkLabel(self.frame, text=" which_my_toast", image=self.logo, compound="left", font=customtkinter.CTkFont(size=15, weight="bold"))
self.frame_label.grid(row=0, column=0, padx=20, pady=20)
self.library_text = customtkinter.CTkLabel(self.frame, text="Library", compound="left")
self.library_text.grid(row=1, column=0, sticky="ew")
self.winotify_button = customtkinter.CTkButton(self.frame, height=40, border_spacing=10, text="Winotify", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.frame_select_winotify)
self.winotify_button.grid(row=2, column=0, sticky="ew")
self.plyer_button = customtkinter.CTkButton(self.frame, height=40, border_spacing=10, text="Plyer", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.frame_select_plyer)
self.plyer_button.grid(row=3, column=0, sticky="ew")
self.info_button = customtkinter.CTkButton(self.frame,height=40, border_spacing=10, text="About this app", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.which_info)
self.info_button.grid(row=4, column=0, sticky="ew")
#winotify欄
self.winotify_frame = customtkinter.CTkFrame(self, fg_color="transparent")
self.winotify_frame.grid_columnconfigure(0, weight=1)
self.wn_title_label = customtkinter.CTkLabel(self.winotify_frame, text="Winotify", font=self.title_font)
self.wn_title_label.grid(row=1, column=0, padx=2, pady=5)
self.wn_info1_label = customtkinter.CTkLabel(self.winotify_frame, text="Recommended method for Windows 10 or later.", font=self.info_font)
self.wn_info1_label.grid(row=2, column=0, padx=5, pady=5)
self.wn_info2_label = customtkinter.CTkLabel(self.winotify_frame, text="※ App icons are not available.", font=self.info_font)
self.wn_info2_label.grid(row=3, column=0, padx=0, pady=0)
self.wn_app_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="Application Title", width=520)
self.wn_app_textbox.grid(row=4, column=0, padx=20, pady=10)
self.wn_title_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="Title", width=520)
self.wn_title_textbox.grid(row=5, column=0, padx=20, pady=10)
self.wn_msg_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="Message", width=520)
self.wn_msg_textbox.grid(row=6, column=0, padx=20, pady=10)
self.wn_icon_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="Message Icon Path", width=520)
self.wn_icon_textbox.grid(row=7, column=0, padx=20, pady=10)
self.wn_send_button = customtkinter.CTkButton(self.winotify_frame, text="Send",compound="right", command=self.winotify_send)
self.wn_send_button.grid(row=8, column=0, padx=40, pady=20)
#Plyer欄
self.plyer_frame = customtkinter.CTkFrame(self, fg_color="transparent")
self.plyer_frame.grid_columnconfigure(0, weight=1)
self.plyer_title_label = customtkinter.CTkLabel(self.plyer_frame, text="Plyer", font=self.title_font)
self.plyer_title_label.grid(row=1, column=0, padx=2, pady=5)
self.plyer_info1_label = customtkinter.CTkLabel(self.plyer_frame, text="Recommended method for legacy operating systems such as Windows 7", font=self.info_font)
self.plyer_info1_label.grid(row=2, column=0, padx=5, pady=5)
#self.plyer_info2_label = customtkinter.CTkLabel(self.plyer_frame, text="※アプリアイコンはicoファイルを指定してください。", font=self.info_font)
#self.plyer_info2_label.grid(row=3, column=0, padx=0, pady=0)
self.plyer_title_textbox = customtkinter.CTkEntry(self.plyer_frame, placeholder_text="Title", width=520)
self.plyer_title_textbox.grid(row=4, column=0, padx=20, pady=10)
self.plyer_msg_textbox = customtkinter.CTkEntry(self.plyer_frame, placeholder_text="Message", width=520)
self.plyer_msg_textbox.grid(row=5, column=0, padx=20, pady=10)
self.plyer_icon_textbox = customtkinter.CTkEntry(self.plyer_frame, placeholder_text="Application Icon Path (only ico image)", width=520)
self.plyer_icon_textbox.grid(row=6, column=0, padx=20, pady=10)
self.plyer_send_button = customtkinter.CTkButton(self.plyer_frame, text="Send", command=self.plyer_send)
self.plyer_send_button.grid(row=7, column=0, padx=40, pady=10)
self.select_frame_name("winotify_frame")
def select_frame_name(self, name):
self.winotify_button.configure(fg_color=("gray75", "gray25") if name == "winotify_frame" else "transparent")
self.plyer_button.configure(fg_color=("gray75", "gray25") if name == "plyer_frame" else "transparent")
if name == "winotify_frame":
self.winotify_frame.grid(row=0, column=1, sticky="nsew")
else:
self.winotify_frame.grid_forget()
if name == "plyer_frame":
self.plyer_frame.grid(row=0, column=1, sticky="nsew")
else:
self.plyer_frame.grid_forget()
def frame_select_winotify(self):
self.select_frame_name("winotify_frame")
def frame_select_plyer(self):
self.select_frame_name("plyer_frame")
#通知送信部
def winotify_send(self):
winotify_notification = Notification(
app_id = self.wn_app_textbox.get(),
title = self.wn_title_textbox.get(),
msg = self.wn_msg_textbox.get(),
icon = self.wn_icon_textbox.get()
)
winotify_notification.set_audio(audio.Default, loop=False)
winotify_notification.show()
def plyer_send(self):
notification.notify(
title = self.plyer_title_textbox.get(),
message = self.plyer_msg_textbox.get(),
app_icon = self.plyer_icon_textbox.get()
)
def which_info(self):
print(version)
which_info_msg_base = "which_my_toast Version {} \nBuild Date {}"
notification.notify(
title = "About this app",
message = which_info_msg_base.format(version,builddate),
app_icon = r"lib\logo.ico"
)
if __name__ == "__main__":
app = App()
app.mainloop()

463
jp.py Normal file
View file

@ -0,0 +1,463 @@
import tkinter as tk
from tkinter import messagebox
import customtkinter
import os
from PIL import Image
from winotify import Notification, audio
from plyer import notification
from windows_toasts import Toast, ToastDisplayImage, WindowsToaster, InteractableWindowsToaster, AudioSource, ToastAudio, ToastDuration, ToastScenario
version = "0.2"
builddate = "2023/8/12"
class App(customtkinter.CTk):
def __init__(self):
super().__init__()
self.title("which_my_toast")
self.iconbitmap(r".\lib\logo.ico")
self.geometry("820x330")
#1055x330 アクション欄想定
self.resizable(height=False, width=False)
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(1, weight=1)
image_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "lib")
self.logo = customtkinter.CTkImage(Image.open(os.path.join(image_path, "logo.png")), size=(59, 54))
self.title_font = customtkinter.CTkFont(family="meiryo", size=20, weight="bold")
self.info_font = customtkinter.CTkFont(family="meiryo", size=14)
self.ui_font = customtkinter.CTkFont(family="meiryo", size=12)
self.button_font = customtkinter.CTkFont(family="meiryo", size=14, weight="bold")
self.frame = customtkinter.CTkFrame(self, corner_radius=0)
self.frame.grid(row=0, column=0, sticky="nsew")
self.frame.grid_columnconfigure(6, weight=1)
self.frame_label = customtkinter.CTkLabel(self.frame, text=" which_my_toast", image=self.logo, compound="left", font=customtkinter.CTkFont(size=15, weight="bold"))
self.frame_label.grid(row=0, column=0, padx=20, pady=20)
self.library_text = customtkinter.CTkLabel(self.frame, text="ライブラリ", compound="left", font=self.ui_font)
self.library_text.grid(row=1, column=0, sticky="ew")
self.winotify_button = customtkinter.CTkButton(self.frame, height=40, border_spacing=10, text="Winotify", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.frame_select_winotify, font=self.ui_font)
self.winotify_button.grid(row=2, column=0, sticky="ew")
self.plyer_button = customtkinter.CTkButton(self.frame, height=40, border_spacing=10, text="Plyer", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.frame_select_plyer, font=self.ui_font)
self.plyer_button.grid(row=3, column=0, sticky="ew")
self.wintoasts_button = customtkinter.CTkButton(self.frame, height=40, border_spacing=10, text="Windows-Toasts", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.frame_select_wintoasts, font=self.ui_font)
self.wintoasts_button.grid(row=4, column=0, sticky="ew")
self.tkmsg_button = customtkinter.CTkButton(self.frame, height=40, border_spacing=10, text="Tkinter_messagebox", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.frame_select_tkmsg, font=self.ui_font)
self.tkmsg_button.grid(row=5, column=0, sticky="ew")
self.info_button = customtkinter.CTkButton(self.frame,height=40, border_spacing=10, text="バージョン情報", fg_color="transparent", text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"), anchor="w", command=self.which_info, font=self.ui_font)
self.info_button.grid(row=6, column=0, sticky="ew")
#winotify欄
self.winotify_frame = customtkinter.CTkFrame(self, fg_color="transparent")
self.winotify_frame.grid_rowconfigure(5,weight=1)
self.winotify_frame.grid_columnconfigure(5, weight=1)
self.wn_app_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="アプリ名を入力...", width=520, font=self.ui_font)
self.wn_app_textbox.grid(row=0, column=0, padx=24, pady=15)
self.wn_title_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="タイトルを入力...", width=520, font=self.ui_font)
self.wn_title_textbox.grid(row=1, column=0, padx=24, pady=15)
self.wn_msg_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="メッセージを入力...", width=520, font=self.ui_font)
self.wn_msg_textbox.grid(row=2, column=0, padx=24, pady=15)
self.wn_icon_textbox = customtkinter.CTkEntry(self.winotify_frame, placeholder_text="メッセージに使うアイコンのパスを入力... 未入力の場合はアイコンなし", width=520, font=self.ui_font)
self.wn_icon_textbox.grid(row=3, column=0, padx=24, pady=15)
self.wn_control_frame = customtkinter.CTkFrame(self.winotify_frame, fg_color="transparent")
self.wn_control_frame.grid(row=4, column=0)
self.wn_control_frame.grid_rowconfigure(4, weight=1)
self.wn_control_frame.grid_columnconfigure(1, weight=1)
self.wn_audio_switch = customtkinter.CTkSwitch(self.wn_control_frame, text="通知音を再生", font=self.ui_font)
self.wn_audio_switch.grid(row=1, column=0, padx=15, pady=15)
self.wn_audio_text = customtkinter.CTkLabel(self.wn_control_frame, text="通知音を選択", font=self.ui_font)
self.wn_audio_text.grid(row=1, column=1, padx=4, pady=15)
self.wn_audio_select = customtkinter.CTkComboBox(self.wn_control_frame, values=["Default", "Mail", "Reminder", "SMS"], font=self.ui_font, dropdown_font=self.ui_font)
self.wn_audio_select.grid(row=1, column=2, padx=4, pady=4)
self.wn_icon_button = customtkinter.CTkButton(self.wn_control_frame, text="アイコン選択", command=self.winotify_icon_select, font=self.button_font)
self.wn_icon_button.grid(row=0, column=3, padx=15,pady=4)
"""self.action_frame = customtkinter.CTkFrame(self.winotify_frame)
self.action_frame.grid(row=0, column=1, padx=0, pady=15)
self.action_frame.grid_rowconfigure(5, weight=1)
self.action_frame.grid_columnconfigure(0, weight=1)
self.action_button = customtkinter.CTkSwitch(self.action_frame, text="ボタンを追加する", font=self.ui_font)
self.action_button.grid(padx=4, pady=15)
self.action_text1 = customtkinter.CTkEntry(self.action_frame, placeholder_text="ボタンのタイトルを入力...", font=self.ui_font)
self.action_text1.grid(row=1, pady=15)"""
self.wn_send_button = customtkinter.CTkButton(self.wn_control_frame, text="送信", command=self.winotify_send, font=self.button_font)
self.wn_send_button.grid(row=1, column=3, padx=15, pady=15)
#Plyer欄
self.plyer_frame = customtkinter.CTkFrame(self, fg_color="transparent")
self.plyer_frame.grid_rowconfigure(4, weight=1)
self.plyer_frame.grid_columnconfigure(2, weight=1)
self.plyer_info1_label = customtkinter.CTkLabel(self.plyer_frame, text="Plyerを用いて通知を送信します。Windows 7などレガシーOS向けです。", font=self.info_font)
self.plyer_info1_label.grid(row=0, column=0, padx=24, pady=15)
self.plyer_title_textbox = customtkinter.CTkEntry(self.plyer_frame, placeholder_text="タイトルを入力...", width=520, font=self.ui_font)
self.plyer_title_textbox.grid(row=1, column=0, padx=24, pady=15)
self.plyer_msg_textbox = customtkinter.CTkEntry(self.plyer_frame, placeholder_text="メッセージを入力...", width=520, font=self.ui_font)
self.plyer_msg_textbox.grid(row=2, column=0, padx=24, pady=15)
self.plyer_icon_textbox = customtkinter.CTkEntry(self.plyer_frame, placeholder_text="アイコンのパスを入力... 未入力の場合はアイコンなし", width=520, font=self.ui_font)
self.plyer_icon_textbox.grid(row=3, column=0, padx=24, pady=15)
self.plyer_control_frame = customtkinter.CTkFrame(self.plyer_frame, fg_color="transparent")
self.plyer_control_frame.grid(row=4)
self.plyer_control_frame.grid_rowconfigure(0, weight=1)
self.plyer_control_frame.grid_columnconfigure(1, weight=1)
self.plyer_icon_button = customtkinter.CTkButton(self.plyer_control_frame, text="アイコン選択", command=self.plyer_icon_select, font=self.button_font)
self.plyer_icon_button.grid(row=0, column=0, padx=20, pady=15)
self.plyer_send_button = customtkinter.CTkButton(self.plyer_control_frame, text="送信", command=self.plyer_send, font=self.button_font)
self.plyer_send_button.grid(row=0, column=1, padx=20, pady=15)
#windows_toasts欄
self.wintoasts_frame = customtkinter.CTkFrame(self, fg_color="transparent")
self.wintoasts_frame.grid_rowconfigure(5,weight=1)
self.wintoasts_frame.grid_columnconfigure(5, weight=1)
self.wintoasts_app_textbox = customtkinter.CTkEntry(self.wintoasts_frame, placeholder_text="アプリ名を入力...", width=520, font=self.ui_font)
self.wintoasts_app_textbox.grid(row=0, column=0, padx=15, pady=15)
self.wintoasts_title_textbox = customtkinter.CTkEntry(self.wintoasts_frame, placeholder_text="タイトルを入力...", width=520, font=self.ui_font)
self.wintoasts_title_textbox.grid(row=1, column=0, padx=15, pady=15)
self.wintoasts_msg_textbox = customtkinter.CTkEntry(self.wintoasts_frame, placeholder_text="メッセージを入力...", width=520, font=self.ui_font)
self.wintoasts_msg_textbox.grid(row=2, column=0, padx=15, pady=15)
self.wintoasts_icon_textbox = customtkinter.CTkEntry(self.wintoasts_frame, placeholder_text="メッセージに使うアイコンのパスを入力... 未入力の場合はアイコンなし", width=520, font=self.ui_font)
self.wintoasts_icon_textbox.grid(row=3, column=0, padx=15, pady=15)
self.wintoasts_control_frame = customtkinter.CTkFrame(self.wintoasts_frame, fg_color="transparent")
self.wintoasts_control_frame.grid(row=4, column=0)
self.wintoasts_control_frame.grid_rowconfigure(4, weight=1)
self.wintoasts_control_frame.grid_columnconfigure(1, weight=1)
self.wintoasts_audio_switch = customtkinter.CTkSwitch(self.wintoasts_control_frame, text="通知音を再生", font=self.ui_font)
self.wintoasts_audio_switch.grid(row=1, column=0, padx=1, pady=4)
self.wintoasts_scene_text = customtkinter.CTkLabel(self.wintoasts_control_frame, text="シーンと表示時間", font=self.ui_font)
self.wintoasts_scene_text.grid(row=0, column=0, padx=4, pady=4)
self.wintoasts_scene_select = customtkinter.CTkComboBox(self.wintoasts_control_frame, values=["Default", "alarm", "reminder", "incomingCall", "urgent"], font=self.ui_font, dropdown_font=self.ui_font)
self.wintoasts_scene_select.grid(row=0, column=1, padx=4, pady=4)
self.wintoasts_audio_text = customtkinter.CTkLabel(self.wintoasts_control_frame, text="通知音を選択", font=self.ui_font)
self.wintoasts_audio_text.grid(row=1, column=1, padx=4, pady=4)
self.wintoasts_audio_select = customtkinter.CTkComboBox(self.wintoasts_control_frame, values=["Default", "Mail", "SMS"], font=self.ui_font, dropdown_font=self.ui_font)
self.wintoasts_audio_select.grid(row=1, column=2, padx=4, pady=4)
self.wintoasts_icon_button = customtkinter.CTkButton(self.wintoasts_control_frame, text="アイコン選択", command=self.wintoasts_icon_select, font=self.button_font)
self.wintoasts_icon_button.grid(row=0, column=3, padx=4,pady=4)
self.wintoasts_duration_select = customtkinter.CTkComboBox(self.wintoasts_control_frame, values=["標準", "短め", "長め"], font=self.ui_font, dropdown_font=self.ui_font)
self.wintoasts_duration_select.grid(row=0, column=2, padx=4, pady=4)
self.wintoasts_send_button = customtkinter.CTkButton(self.wintoasts_control_frame, text="送信", command=self.wintoasts_send, font=self.button_font)
self.wintoasts_send_button.grid(row=1, column=3, padx=15, pady=15)
#tkinter_messagebox欄
self.tkmsg_frame = customtkinter.CTkFrame(self, fg_color="transparent")
self.tkmsg_frame.grid_rowconfigure(5,weight=1)
self.tkmsg_frame.grid_columnconfigure(5, weight=1)
self.tkmsg_title_textbox = customtkinter.CTkEntry(self.tkmsg_frame, placeholder_text="タイトルを入力...", width=520, font=self.ui_font)
self.tkmsg_title_textbox.grid(row=0, column=0, padx=15, pady=15)
self.tkmsg_msg_textbox = customtkinter.CTkEntry(self.tkmsg_frame, placeholder_text="メッセージを入力...", width=520, font=self.ui_font)
self.tkmsg_msg_textbox.grid(row=1, column=0, padx=15, pady=15)
self.tkmsg_control_frame = customtkinter.CTkFrame(self.tkmsg_frame, fg_color="transparent")
self.tkmsg_control_frame.grid(row=3, column=0)
self.tkmsg_control_frame.grid_rowconfigure(4, weight=1)
self.tkmsg_control_frame.grid_columnconfigure(1, weight=1)
self.tkmsg_scene_text = customtkinter.CTkLabel(self.tkmsg_control_frame, text="シーン", font=self.ui_font)
self.tkmsg_scene_text.grid(row=0, column=0, padx=4, pady=4)
self.tkmsg_scene_select = customtkinter.CTkComboBox(self.tkmsg_control_frame, values=["showerror", "showwarning", "showinfo", "askquestion", "askokcancel", "askretrycancel", "askyesno", "askyesnocancel"], font=self.ui_font, dropdown_font=self.ui_font)
self.tkmsg_scene_select.grid(row=0, column=1, padx=4, pady=4)
self.tkmsg_icon_text = customtkinter.CTkLabel(self.tkmsg_control_frame, text="アイコンを上書き", font=self.ui_font)
self.tkmsg_icon_text.grid(row=1, column=0, padx=4, pady=4)
self.tkmsg_icon_select = customtkinter.CTkComboBox(self.tkmsg_control_frame, values=["error", "info", "question", "warning"], font=self.ui_font, dropdown_font=self.ui_font)
self.tkmsg_icon_select.grid(row=1, column=1, padx=4, pady=4)
self.tkmsg_send_button = customtkinter.CTkButton(self.tkmsg_control_frame, text="送信", command=self.tkmsg_send, font=self.button_font)
self.tkmsg_send_button.grid(row=1, column=4, padx=60, pady=15)
self.select_frame_name("winotify_frame")
def select_frame_name(self, name):
self.winotify_button.configure(fg_color=("gray75", "gray25") if name == "winotify_frame" else "transparent")
self.plyer_button.configure(fg_color=("gray75", "gray25") if name == "plyer_frame" else "transparent")
self.wintoasts_button.configure(fg_color=("gray75", "gray25") if name == "wintoasts_frame" else "transparent")
self.tkmsg_button.configure(fg_color=("gray75", "gray25") if name == "tkmsg_frame" else "transparent")
if name == "winotify_frame":
self.winotify_frame.grid(row=0, column=1, sticky="nsew")
else:
self.winotify_frame.grid_forget()
if name == "plyer_frame":
self.plyer_frame.grid(row=0, column=1, sticky="nsew")
else:
self.plyer_frame.grid_forget()
if name == "wintoasts_frame":
self.wintoasts_frame.grid(row=0, column=1, sticky="nsew")
else:
self.wintoasts_frame.grid_forget()
if name == "tkmsg_frame":
self.tkmsg_frame.grid(row=0, column=1, sticky="nsew")
else:
self.tkmsg_frame.grid_forget()
def frame_select_winotify(self):
self.select_frame_name("winotify_frame")
def frame_select_plyer(self):
self.select_frame_name("plyer_frame")
def frame_select_wintoasts(self):
self.select_frame_name("wintoasts_frame")
def frame_select_tkmsg(self):
self.select_frame_name("tkmsg_frame")
def winotify_icon_select(self):
wn_icon_type = [('画像ファイル','*.png *.jpg *.ico')]
wn_icon_path = tk.filedialog.askopenfilename(title="アイコンを選択...", filetypes = wn_icon_type, initialdir = r".\icon")
self.wn_icon_textbox.delete(0, tk.END)
self.wn_icon_textbox.insert(0, wn_icon_path)
def plyer_icon_select(self):
pl_icon_type = [('アイコンファイル','*.ico')]
pl_icon_path = tk.filedialog.askopenfilename(title="アイコンを選択...", filetypes = pl_icon_type, initialdir = r".\icon")
self.plyer_icon_textbox.delete(0, tk.END)
self.plyer_icon_textbox.insert(0, pl_icon_path)
def wintoasts_icon_select(self):
wintoasts_icon_type = [('画像ファイル','*.png *.jpg *.ico')]
wintoasts_icon_path = tk.filedialog.askopenfilename(title="アイコンを選択...", filetypes = wintoasts_icon_type, initialdir = r".\icon")
self.wintoasts_icon_textbox.delete(0, tk.END)
self.wintoasts_icon_textbox.insert(0, wintoasts_icon_path)
#通知送信部
def winotify_send(self):
winotify_notification = Notification(
app_id = self.wn_app_textbox.get(),
title = self.wn_title_textbox.get(),
msg = self.wn_msg_textbox.get(),
icon = self.wn_icon_textbox.get()
)
winotify_audio_check = self.wn_audio_switch.get()
if winotify_audio_check == 1:
wn_audio_check_name = self.wn_audio_select.get()
if wn_audio_check_name == "Default":
winotify_notification.set_audio(audio.Default, loop=False)
if wn_audio_check_name == "Mail":
winotify_notification.set_audio(audio.Mail, loop=False)
if wn_audio_check_name == "Reminder":
winotify_notification.set_audio(audio.Reminder, loop=False)
if wn_audio_check_name == "SMS":
winotify_notification.set_audio(audio.SMS, loop=False)
winotify_notification.show()
def plyer_send(self):
notification.notify(
title = self.plyer_title_textbox.get(),
message = self.plyer_msg_textbox.get(),
app_icon = self.plyer_icon_textbox.get()
)
def wintoasts_send(self):
if self.wintoasts_icon_textbox.get() == "":
wintoasts_text_notification = InteractableWindowsToaster(self.wintoasts_msg_textbox.get())
wintoasts_text_notification_base = Toast()
wintoasts_text_notification_base.SetBody(self.wintoasts_title_textbox.get())
wintoasts_audio_check = self.wintoasts_audio_switch.get()
#通知音
if wintoasts_audio_check == 1:
wintoasts_audio_check_name = self.wintoasts_audio_select.get()
if wintoasts_audio_check_name == "Default":
wintoasts_text_notification_base.SetAudio(ToastAudio(AudioSource.Default))
if wintoasts_audio_check_name == "Mail":
wintoasts_text_notification_base.SetAudio(ToastAudio(AudioSource.Mail))
if wintoasts_audio_check_name == "SMS":
wintoasts_text_notification_base.SetAudio(ToastAudio(AudioSource.SMS))
else:
wintoasts_text_notification_base.SetAudio(ToastAudio(silent=True))
#表示時間(11だと変わらん)
wintoasts_duration_check = self.wintoasts_duration_select.get()
if wintoasts_duration_check == "標準":
wintoasts_text_notification_base.SetDuration(ToastDuration("Default"))
if wintoasts_duration_check == "短め":
wintoasts_text_notification_base.SetDuration(ToastDuration("short"))
if wintoasts_duration_check == "長め":
wintoasts_text_notification_base.SetDuration(ToastDuration("long"))
#シーン
wintoasts_scene_check = self.wintoasts_scene_select.get()
if wintoasts_scene_check == "Default":
pass
else:
wintoasts_text_notification_base.SetScenario(ToastScenario(wintoasts_scene_check))
wintoasts_text_notification.show_toast(wintoasts_text_notification_base)
else:
wintoasts_img_notification = WindowsToaster(self.wintoasts_app_textbox.get())
wintoasts_img_notification_base = Toast()
wintoasts_img_notification_base.SetHeadline(self.wintoasts_title_textbox.get())
wintoasts_img_notification_base.SetBody(self.wintoasts_msg_textbox.get())
wintoasts_img_notification_base.AddImage(ToastDisplayImage.fromPath(self.wintoasts_icon_textbox.get()))
#通知音
wintoasts_audio_check = self.wintoasts_audio_switch.get()
if wintoasts_audio_check == 1:
wintoasts_audio_check_name = self.wintoasts_audio_select.get()
if wintoasts_audio_check_name == "Default":
wintoasts_img_notification_base.SetAudio(ToastAudio(AudioSource.Default))
if wintoasts_audio_check_name == "Mail":
wintoasts_img_notification_base.SetAudio(ToastAudio(AudioSource.Mail))
if wintoasts_audio_check_name == "SMS":
wintoasts_img_notification_base.SetAudio(ToastAudio(AudioSource.SMS))
else:
wintoasts_img_notification_base.SetAudio(ToastAudio(silent=True))
#表示時間
wintoasts_duration_check = self.wintoasts_duration_select.get()
if wintoasts_duration_check == "標準":
wintoasts_img_notification_base.SetDuration(ToastDuration("Default"))
if wintoasts_duration_check == "短め":
wintoasts_img_notification_base.SetDuration(ToastDuration("short"))
if wintoasts_duration_check == "長め":
wintoasts_img_notification_base.SetDuration(ToastDuration("long"))
#シーン
wintoasts_scene_check = self.wintoasts_scene_select.get()
if wintoasts_scene_check == "Default":
pass
else:
wintoasts_img_notification_base.SetScenario(ToastScenario(wintoasts_scene_check))
wintoasts_img_notification.show_toast(wintoasts_img_notification_base)
def tkmsg_send(self):
tkmsg_scene_check = self.tkmsg_scene_select.get()
if tkmsg_scene_check == "showerror":
messagebox.showerror(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "showwarning":
messagebox.showwarning(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "showinfo":
messagebox.showinfo(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "askquestion":
messagebox.askquestion(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "askokcancel":
messagebox.askokcancel(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "askretrycancel":
messagebox.askretrycancel(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "askyesno":
messagebox.askyesno(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
elif tkmsg_scene_check == "askyesnocancel":
messagebox.askyesnocancel(
title = self.tkmsg_title_textbox.get(),
message = self.tkmsg_msg_textbox.get(),
icon = self.tkmsg_icon_select.get(),
)
def which_info(self):
print(version)
which_info_msg_base = "which_my_toast バージョン {} \nビルド日時 {}"
notification.notify(
title = "このアプリについて",
message = which_info_msg_base.format(version,builddate),
app_icon = r"lib\logo.ico"
)
if __name__ == "__main__":
app = App()
app.mainloop()

51
jp.spec Normal file
View file

@ -0,0 +1,51 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['jp.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=['plyer.platforms.win.notification'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='jp',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['lib\\logo.ico'],
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='jp',
)

BIN
lib/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
lib/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

5
pyinstaller.txt Normal file
View file

@ -0,0 +1,5 @@
old
C:\Users\suti7\AppData\Local\Programs\Python\Python38-32\Scripts\pyinstaller.exe jp.py --noconsole --onedir -i .\lib\logo.ico --hidden-import plyer.platforms.win.notification
for onefile
pyinstaller .\jp.py --noconsole --onefile -i .\lib\logo.ico --hidden-import plyer.platforms.win.notification --add-data "C:\Users\suti7\Dev\temp\which_my_toast\lib:lib"