質問編集履歴
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,4 +5,350 @@
|
|
5
5
|
|
6
6
|
お手数をおかけしますが,回答のほどよろしくお願い致します.
|
7
7
|
|
8
|
-

|
8
|
+

|
9
|
+
|
10
|
+
|
11
|
+
## コード
|
12
|
+
```Python
|
13
|
+
#キー取得のためのライブラリ
|
14
|
+
import msvcrt
|
15
|
+
|
16
|
+
import time
|
17
|
+
|
18
|
+
import sys
|
19
|
+
|
20
|
+
#import wave
|
21
|
+
|
22
|
+
#wave形式の音声を扱うためのライブラリ
|
23
|
+
import winsound as ws
|
24
|
+
|
25
|
+
|
26
|
+
#-----------------------------------------------
|
27
|
+
#音を出すための関数(ローマ字)
|
28
|
+
def a():
|
29
|
+
sound_name = 'alphabet01_a_01.wav'
|
30
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
31
|
+
|
32
|
+
def b():
|
33
|
+
sound_name = 'alphabet01_b_01.wav'
|
34
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
35
|
+
|
36
|
+
def c():
|
37
|
+
sound_name = 'alphabet01_c_01.wav'
|
38
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
39
|
+
|
40
|
+
def d():
|
41
|
+
sound_name = 'alphabet01_d_01.wav'
|
42
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
43
|
+
|
44
|
+
def e():
|
45
|
+
sound_name = 'alphabet01_e_01.wav'
|
46
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
47
|
+
|
48
|
+
def f():
|
49
|
+
sound_name = 'alphabet01_f_01.wav'
|
50
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
51
|
+
|
52
|
+
def g():
|
53
|
+
sound_name = 'alphabet01_g_01.wav'
|
54
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
55
|
+
|
56
|
+
def h():
|
57
|
+
sound_name = 'alphabet01_h_01.wav'
|
58
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
59
|
+
|
60
|
+
def i():
|
61
|
+
sound_name = 'alphabet01_i_01.wav'
|
62
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
63
|
+
|
64
|
+
def j():
|
65
|
+
sound_name = 'alphabet01_j_01.wav'
|
66
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
67
|
+
|
68
|
+
def k():
|
69
|
+
sound_name = 'alphabet01_k_01.wav'
|
70
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
71
|
+
|
72
|
+
def l():
|
73
|
+
sound_name = 'alphabet01_l_01.wav'
|
74
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
75
|
+
|
76
|
+
def m():
|
77
|
+
sound_name = 'alphabet01_m_01.wav'
|
78
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
79
|
+
|
80
|
+
def n():
|
81
|
+
sound_name = 'alphabet01_n_01.wav'
|
82
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
83
|
+
|
84
|
+
def o():
|
85
|
+
sound_name = 'alphabet01_o_01.wav'
|
86
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
87
|
+
|
88
|
+
def p():
|
89
|
+
sound_name = 'alphabet01_p_01.wav'
|
90
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
91
|
+
|
92
|
+
def q():
|
93
|
+
sound_name = 'alphabet01_q_01.wav'
|
94
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
95
|
+
|
96
|
+
def r():
|
97
|
+
sound_name = 'alphabet01_r_01.wav'
|
98
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
99
|
+
|
100
|
+
def s():
|
101
|
+
sound_name = 'alphabet01_s_01.wav'
|
102
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
103
|
+
|
104
|
+
def t():
|
105
|
+
sound_name = 'alphabet01_t_01.wav'
|
106
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
107
|
+
|
108
|
+
def u():
|
109
|
+
sound_name = 'alphabet01_u_01.wav'
|
110
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
111
|
+
|
112
|
+
def v():
|
113
|
+
sound_name = 'alphabet01_v_01.wav'
|
114
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
115
|
+
|
116
|
+
def w():
|
117
|
+
sound_name = 'alphabet01_w_01.wav'
|
118
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
119
|
+
|
120
|
+
def x():
|
121
|
+
sound_name = 'alphabet01_x_01.wav'
|
122
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
123
|
+
|
124
|
+
def y():
|
125
|
+
sound_name = 'alphabet01_y_01.wav'
|
126
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
127
|
+
|
128
|
+
def z():
|
129
|
+
sound_name = 'alphabet01_z_01.wav'
|
130
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
131
|
+
|
132
|
+
#-----------------------------------------------
|
133
|
+
#音を出すための関数(数字)
|
134
|
+
|
135
|
+
def zero():
|
136
|
+
sound_name = 'num000_01.wav'
|
137
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
138
|
+
|
139
|
+
def one():
|
140
|
+
sound_name = 'num001_01.wav'
|
141
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
142
|
+
|
143
|
+
def two():
|
144
|
+
sound_name = 'num002_01.wav'
|
145
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
146
|
+
|
147
|
+
def three():
|
148
|
+
sound_name = 'num003_01.wav'
|
149
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
150
|
+
|
151
|
+
def four():
|
152
|
+
sound_name = 'num004_01.wav'
|
153
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
154
|
+
|
155
|
+
def five():
|
156
|
+
sound_name = 'num005_01.wav'
|
157
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
158
|
+
|
159
|
+
def six():
|
160
|
+
sound_name = 'num006_01.wav'
|
161
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
162
|
+
|
163
|
+
def seven():
|
164
|
+
sound_name = 'num007_01.wav'
|
165
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
166
|
+
|
167
|
+
def eight():
|
168
|
+
sound_name = 'num008_01.wav'
|
169
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
170
|
+
|
171
|
+
def nine():
|
172
|
+
sound_name = 'num009_01.wav'
|
173
|
+
ws.PlaySound(sound_name,ws.SND_FILENAME)
|
174
|
+
#-----------------------------------------------
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
#メインとなる関数
|
180
|
+
def blind_touch():
|
181
|
+
|
182
|
+
while True:
|
183
|
+
|
184
|
+
time.sleep(0.01)
|
185
|
+
|
186
|
+
#キーが押されているか
|
187
|
+
if msvcrt.kbhit():
|
188
|
+
|
189
|
+
#押されていれば,キーを取得する
|
190
|
+
kb = msvcrt.getch()
|
191
|
+
|
192
|
+
print(kb)
|
193
|
+
|
194
|
+
if kb.decode() == "a":
|
195
|
+
|
196
|
+
a()
|
197
|
+
|
198
|
+
elif kb.decode() == "b":
|
199
|
+
|
200
|
+
b()
|
201
|
+
|
202
|
+
elif kb.decode() == "c":
|
203
|
+
|
204
|
+
c()
|
205
|
+
|
206
|
+
elif kb.decode() == "d":
|
207
|
+
|
208
|
+
d()
|
209
|
+
|
210
|
+
elif kb.decode() == "e":
|
211
|
+
|
212
|
+
e()
|
213
|
+
|
214
|
+
elif kb.decode() == "f":
|
215
|
+
|
216
|
+
f()
|
217
|
+
|
218
|
+
elif kb.decode() == "g":
|
219
|
+
|
220
|
+
g()
|
221
|
+
|
222
|
+
elif kb.decode() == "h":
|
223
|
+
|
224
|
+
h()
|
225
|
+
|
226
|
+
elif kb.decode() == "i":
|
227
|
+
|
228
|
+
i()
|
229
|
+
|
230
|
+
elif kb.decode() == "j":
|
231
|
+
|
232
|
+
j()
|
233
|
+
|
234
|
+
elif kb.decode() == "k":
|
235
|
+
|
236
|
+
k()
|
237
|
+
|
238
|
+
elif kb.decode() == "l":
|
239
|
+
|
240
|
+
l()
|
241
|
+
|
242
|
+
elif kb.decode() == "m":
|
243
|
+
|
244
|
+
m()
|
245
|
+
|
246
|
+
elif kb.decode() == "n":
|
247
|
+
|
248
|
+
n()
|
249
|
+
|
250
|
+
elif kb.decode() == "o":
|
251
|
+
|
252
|
+
o()
|
253
|
+
|
254
|
+
elif kb.decode() == "p":
|
255
|
+
|
256
|
+
p()
|
257
|
+
|
258
|
+
elif kb.decode() == "q":
|
259
|
+
|
260
|
+
q()
|
261
|
+
|
262
|
+
elif kb.decode() == "r":
|
263
|
+
|
264
|
+
r()
|
265
|
+
|
266
|
+
elif kb.decode() == "s":
|
267
|
+
|
268
|
+
s()
|
269
|
+
|
270
|
+
elif kb.decode() == "t":
|
271
|
+
|
272
|
+
t()
|
273
|
+
|
274
|
+
elif kb.decode() == "u":
|
275
|
+
|
276
|
+
u()
|
277
|
+
|
278
|
+
elif kb.decode() == "v":
|
279
|
+
|
280
|
+
v()
|
281
|
+
|
282
|
+
elif kb.decode() == "w":
|
283
|
+
|
284
|
+
w()
|
285
|
+
|
286
|
+
elif kb.decode() == "x":
|
287
|
+
|
288
|
+
x()
|
289
|
+
|
290
|
+
elif kb.decode() == "y":
|
291
|
+
|
292
|
+
y()
|
293
|
+
|
294
|
+
elif kb.decode() == "z":
|
295
|
+
|
296
|
+
z()
|
297
|
+
|
298
|
+
elif kb.decode() == "0":
|
299
|
+
|
300
|
+
zero()
|
301
|
+
|
302
|
+
elif kb.decode() == "1":
|
303
|
+
|
304
|
+
one()
|
305
|
+
|
306
|
+
elif kb.decode() == "2":
|
307
|
+
|
308
|
+
two()
|
309
|
+
|
310
|
+
elif kb.decode() == "3":
|
311
|
+
|
312
|
+
three()
|
313
|
+
|
314
|
+
elif kb.decode() == "4":
|
315
|
+
|
316
|
+
four()
|
317
|
+
|
318
|
+
elif kb.decode() == "5":
|
319
|
+
|
320
|
+
five()
|
321
|
+
|
322
|
+
elif kb.decode() == "6":
|
323
|
+
|
324
|
+
six()
|
325
|
+
|
326
|
+
elif kb.decode() == "7":
|
327
|
+
|
328
|
+
seven()
|
329
|
+
|
330
|
+
elif kb.decode() == "8":
|
331
|
+
|
332
|
+
eight()
|
333
|
+
|
334
|
+
elif kb.decode() == "9":
|
335
|
+
|
336
|
+
nine()
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
#Enterが押されたら終了
|
341
|
+
if kb.decode() == "\r":
|
342
|
+
|
343
|
+
sys.exit()
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
#コマンドプロンプトで実行
|
351
|
+
if __name__ == "__main__":
|
352
|
+
|
353
|
+
blind_touch()
|
354
|
+
```
|
1
誤字のため
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
## 質問内容
|
2
2
|
|
3
3
|
Pythonで作ったものをexe化して実行しているのですが,
|
4
|
-
exeファイルの画面がメインでないときも実行し続ける方法は
|
4
|
+
exeファイルの画面がメインでないときも実行し続ける方法は無いでしょうか?
|
5
5
|
|
6
6
|
お手数をおかけしますが,回答のほどよろしくお願い致します.
|
7
7
|
|