Skip to content

Commit d376388

Browse files
committed
1.10.1
1 parent 0029250 commit d376388

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

mctoast/__init__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from io import BytesIO
1616
from PIL import Image, ImageDraw, ImageFont, ImageTk
1717
from threading import Thread,Event
18+
import _thread
1819
path=os.path.dirname(__file__)
1920
pathjoin=os.path.join
2021
toasts=[None,None,None,None,None]
@@ -174,20 +175,17 @@ def set_no_focus(self):
174175
self.root.wm_attributes('-type', 'splash')
175176

176177
window=None
177-
def _init(e:Event=None):
178+
def _init():
178179
"""别调用"""
179180
global window
180181
window=ToastWindowUI()
181-
if e:
182-
e.set()
183182
window.main()
184183

185184
def init():
186185
"""初始化窗口"""
187-
e=Event()
188-
t=Thread(target=_init,args=(e))
189-
t.start()
190-
e.wait()
186+
_thread.start_new_thread(_init,())
187+
while window==None:
188+
time.sleep(0.01)
191189

192190
def new_toast(toast=ADVANCEMENT, image_path:str=None, text1="一个弹窗", color1="yellow", text2="MCToast示例", color2="white"):
193191
"""新弹窗

mctoast/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
help="""
33
生成一个MCToast图片或者弹出一个Toast
44
用法:
5-
mctoast -m <参数> [保存路径]
5+
python -m mctoast <参数> [保存路径]
66
77
参数:
88
--toast=<弹窗类型>,-t=<弹窗类型> 指定弹窗类型<0,1,2>
@@ -67,7 +67,7 @@
6767
6868
Rickrolled LOL
6969
"""
70-
print("MCToast 生成器 1.10\n")
70+
print("MCToast 生成器 1.10.1\n")
7171
toasts=(mctoast.ADVANCEMENT,mctoast.RECIPE,mctoast.SYSTEM)
7272
toast=mctoast.ADVANCEMENT
7373
image=None
@@ -104,6 +104,7 @@
104104
if savepath==None:
105105
mctoast.init()
106106
mctoast.new_toast()
107+
mctoast.wait_no_toast()
107108
else:
108109
mctoast.generate_image(toast,image,text1,color1,text2,color2,mctoast.RETURN_SAVETOFILE, False, savepath)
109110
print("已保存:",savepath)

0 commit comments

Comments
 (0)