3
3
生成一个MCToast图片或者弹出一个Toast
4
4
用法:
5
5
python -m mctoast <参数> [保存路径]
6
- mctoast <参数> [保存路径]
7
6
8
7
参数:
9
8
--toast=<弹窗类型>,-t=<弹窗类型> 指定弹窗类型<0,1,2>
28
27
十分的直观 (
29
28
30
29
示例:
31
- mctoast -t=0 -i=1.png -t1=进度已达成! -c1=yellow -t2=MCToast -c2=white
30
+ python -m mctoast -t=0 -i=1.png -t1=进度已达成! -c1=yellow -t2=MCToast -c2=white
32
31
33
- mctoast -t=2 -t1=提示 "-t2=想不到吧 我有空格"
32
+ python -m mctoast -t=2 -t1=提示 "-t2=想不到吧 我有空格"
34
33
35
- mctoast -t=0 -i=1.png -t1=进度已达成! -c1=yellow "-t2=我好像被保存了. . ." -c2=white test.png
34
+ python -m mctoast -t=0 -i=1.png -t1=进度已达成! -c1=yellow "-t2=我好像被保存了. . ." -c2=white test.png
36
35
37
36
本mctoast具有超级牛力
38
37
"""
68
67
69
68
Rickrolled LOL
70
69
"""
71
- def main ():
72
- global help ,moo
73
- print ("MCToast 生成器 1.11\n " )
74
- toasts = (mctoast .ADVANCEMENT ,mctoast .RECIPE ,mctoast .SYSTEM )
75
- toast = mctoast .ADVANCEMENT
76
- image = None
77
- text1 = "进度已达成!"
78
- color1 = "yellow"
79
- text2 = "MCToast示例"
80
- color2 = "white"
81
- savepath = None
82
- if len (sys .argv )> 1 :
83
- argv = sys .argv [1 :]
84
- for arg in argv :
85
- if arg .startswith ("--toast=" ) or arg .startswith ("-t=" ):
86
- toast = arg .split ("=" )[1 ]
87
- elif arg .startswith ("--image=" ) or arg .startswith ("-i=" ):
88
- image = arg .split ("=" )[1 ]
89
- elif arg .startswith ("--title=" ) or arg .startswith ("-t1=" ):
90
- text1 = arg .split ("=" )[1 ]
91
- elif arg .startswith ("--title-color=" ) or arg .startswith ("-c1=" ):
92
- color1 = arg .split ("=" )[1 ]
93
- elif arg .startswith ("--text=" ) or arg .startswith ("-t2=" ):
94
- text2 = arg .split ("=" )[1 ]
95
- elif arg .startswith ("--text-color=" ) or arg .startswith ("-c2=" ):
96
- color2 = arg .split ("=" )[1 ]
97
- elif arg .startswith ("--help" ) or arg .startswith ("-h" ) or arg .startswith ("-?" ):
98
- print (help )
99
- exit (0 )
100
- elif arg == "--moo" :
101
- print (moo )
102
- exit (0 )
103
- else :
104
- savepath = arg
105
- else :
106
- print ("WARNING: 未指定参数,将弹出默认Toast,请使用 --help 查看帮助" )
107
- if savepath == None :
108
- mctoast .init ()
109
- mctoast .new_toast ()
110
- mctoast .wait_no_toast ()
111
- else :
112
- mctoast .generate_image (toast ,image ,text1 ,color1 ,text2 ,color2 ,mctoast .RETURN_SAVETOFILE , False , savepath )
113
- print ("已保存:" ,savepath )
114
-
115
- if __name__ == "__main__" :
116
- main ()
70
+ print ("MCToast 生成器 1.11.1\n " )
71
+ toasts = (mctoast .ADVANCEMENT ,mctoast .RECIPE ,mctoast .SYSTEM )
72
+ toast = mctoast .ADVANCEMENT
73
+ image = None
74
+ text1 = "进度已达成!"
75
+ color1 = "yellow"
76
+ text2 = "MCToast示例"
77
+ color2 = "white"
78
+ savepath = None
79
+ if len (sys .argv )> 1 :
80
+ argv = sys .argv [1 :]
81
+ for arg in argv :
82
+ if arg .startswith ("--toast=" ) or arg .startswith ("-t=" ):
83
+ toast = arg .split ("=" )[1 ]
84
+ elif arg .startswith ("--image=" ) or arg .startswith ("-i=" ):
85
+ image = arg .split ("=" )[1 ]
86
+ elif arg .startswith ("--title=" ) or arg .startswith ("-t1=" ):
87
+ text1 = arg .split ("=" )[1 ]
88
+ elif arg .startswith ("--title-color=" ) or arg .startswith ("-c1=" ):
89
+ color1 = arg .split ("=" )[1 ]
90
+ elif arg .startswith ("--text=" ) or arg .startswith ("-t2=" ):
91
+ text2 = arg .split ("=" )[1 ]
92
+ elif arg .startswith ("--text-color=" ) or arg .startswith ("-c2=" ):
93
+ color2 = arg .split ("=" )[1 ]
94
+ elif arg .startswith ("--help" ) or arg .startswith ("-h" ) or arg .startswith ("-?" ):
95
+ print (help )
96
+ exit (0 )
97
+ elif arg == "--moo" :
98
+ print (moo )
99
+ exit (0 )
100
+ else :
101
+ savepath = arg
102
+ else :
103
+ print ("WARNING: 未指定参数,将弹出默认Toast,请使用 --help 查看帮助" )
104
+ if savepath == None :
105
+ mctoast .init ()
106
+ mctoast .new_toast ()
107
+ mctoast .wait_no_toast ()
108
+ else :
109
+ mctoast .generate_image (toast ,image ,text1 ,color1 ,text2 ,color2 ,mctoast .RETURN_SAVETOFILE , False , savepath )
110
+ print ("已保存:" ,savepath )
0 commit comments