質問編集履歴

2

追記

2020/04/06 00:44

投稿

YProg
YProg

スコア67

test CHANGED
File without changes
test CHANGED
@@ -13,3 +13,695 @@
13
13
 
14
14
 
15
15
  ![イメージ説明](d68a307a4e17fd84f14becd9e349d542.png)
16
+
17
+
18
+
19
+
20
+
21
+ ## コード
22
+
23
+ ```Python
24
+
25
+ #キー取得のためのライブラリ
26
+
27
+ import msvcrt
28
+
29
+
30
+
31
+ import time
32
+
33
+
34
+
35
+ import sys
36
+
37
+
38
+
39
+ #import wave
40
+
41
+
42
+
43
+ #wave形式の音声を扱うためのライブラリ
44
+
45
+ import winsound as ws
46
+
47
+
48
+
49
+
50
+
51
+ #-----------------------------------------------
52
+
53
+ #音を出すための関数(ローマ字)
54
+
55
+ def a():
56
+
57
+ sound_name = 'alphabet01_a_01.wav'
58
+
59
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
60
+
61
+
62
+
63
+ def b():
64
+
65
+ sound_name = 'alphabet01_b_01.wav'
66
+
67
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
68
+
69
+
70
+
71
+ def c():
72
+
73
+ sound_name = 'alphabet01_c_01.wav'
74
+
75
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
76
+
77
+
78
+
79
+ def d():
80
+
81
+ sound_name = 'alphabet01_d_01.wav'
82
+
83
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
84
+
85
+
86
+
87
+ def e():
88
+
89
+ sound_name = 'alphabet01_e_01.wav'
90
+
91
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
92
+
93
+
94
+
95
+ def f():
96
+
97
+ sound_name = 'alphabet01_f_01.wav'
98
+
99
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
100
+
101
+
102
+
103
+ def g():
104
+
105
+ sound_name = 'alphabet01_g_01.wav'
106
+
107
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
108
+
109
+
110
+
111
+ def h():
112
+
113
+ sound_name = 'alphabet01_h_01.wav'
114
+
115
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
116
+
117
+
118
+
119
+ def i():
120
+
121
+ sound_name = 'alphabet01_i_01.wav'
122
+
123
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
124
+
125
+
126
+
127
+ def j():
128
+
129
+ sound_name = 'alphabet01_j_01.wav'
130
+
131
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
132
+
133
+
134
+
135
+ def k():
136
+
137
+ sound_name = 'alphabet01_k_01.wav'
138
+
139
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
140
+
141
+
142
+
143
+ def l():
144
+
145
+ sound_name = 'alphabet01_l_01.wav'
146
+
147
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
148
+
149
+
150
+
151
+ def m():
152
+
153
+ sound_name = 'alphabet01_m_01.wav'
154
+
155
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
156
+
157
+
158
+
159
+ def n():
160
+
161
+ sound_name = 'alphabet01_n_01.wav'
162
+
163
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
164
+
165
+
166
+
167
+ def o():
168
+
169
+ sound_name = 'alphabet01_o_01.wav'
170
+
171
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
172
+
173
+
174
+
175
+ def p():
176
+
177
+ sound_name = 'alphabet01_p_01.wav'
178
+
179
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
180
+
181
+
182
+
183
+ def q():
184
+
185
+ sound_name = 'alphabet01_q_01.wav'
186
+
187
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
188
+
189
+
190
+
191
+ def r():
192
+
193
+ sound_name = 'alphabet01_r_01.wav'
194
+
195
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
196
+
197
+
198
+
199
+ def s():
200
+
201
+ sound_name = 'alphabet01_s_01.wav'
202
+
203
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
204
+
205
+
206
+
207
+ def t():
208
+
209
+ sound_name = 'alphabet01_t_01.wav'
210
+
211
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
212
+
213
+
214
+
215
+ def u():
216
+
217
+ sound_name = 'alphabet01_u_01.wav'
218
+
219
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
220
+
221
+
222
+
223
+ def v():
224
+
225
+ sound_name = 'alphabet01_v_01.wav'
226
+
227
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
228
+
229
+
230
+
231
+ def w():
232
+
233
+ sound_name = 'alphabet01_w_01.wav'
234
+
235
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
236
+
237
+
238
+
239
+ def x():
240
+
241
+ sound_name = 'alphabet01_x_01.wav'
242
+
243
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
244
+
245
+
246
+
247
+ def y():
248
+
249
+ sound_name = 'alphabet01_y_01.wav'
250
+
251
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
252
+
253
+
254
+
255
+ def z():
256
+
257
+ sound_name = 'alphabet01_z_01.wav'
258
+
259
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
260
+
261
+
262
+
263
+ #-----------------------------------------------
264
+
265
+ #音を出すための関数(数字)
266
+
267
+
268
+
269
+ def zero():
270
+
271
+ sound_name = 'num000_01.wav'
272
+
273
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
274
+
275
+
276
+
277
+ def one():
278
+
279
+ sound_name = 'num001_01.wav'
280
+
281
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
282
+
283
+
284
+
285
+ def two():
286
+
287
+ sound_name = 'num002_01.wav'
288
+
289
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
290
+
291
+
292
+
293
+ def three():
294
+
295
+ sound_name = 'num003_01.wav'
296
+
297
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
298
+
299
+
300
+
301
+ def four():
302
+
303
+ sound_name = 'num004_01.wav'
304
+
305
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
306
+
307
+
308
+
309
+ def five():
310
+
311
+ sound_name = 'num005_01.wav'
312
+
313
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
314
+
315
+
316
+
317
+ def six():
318
+
319
+ sound_name = 'num006_01.wav'
320
+
321
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
322
+
323
+
324
+
325
+ def seven():
326
+
327
+ sound_name = 'num007_01.wav'
328
+
329
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
330
+
331
+
332
+
333
+ def eight():
334
+
335
+ sound_name = 'num008_01.wav'
336
+
337
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
338
+
339
+
340
+
341
+ def nine():
342
+
343
+ sound_name = 'num009_01.wav'
344
+
345
+ ws.PlaySound(sound_name,ws.SND_FILENAME)
346
+
347
+ #-----------------------------------------------
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+ #メインとなる関数
358
+
359
+ def blind_touch():
360
+
361
+
362
+
363
+ while True:
364
+
365
+
366
+
367
+ time.sleep(0.01)
368
+
369
+
370
+
371
+ #キーが押されているか
372
+
373
+ if msvcrt.kbhit():
374
+
375
+
376
+
377
+ #押されていれば,キーを取得する
378
+
379
+ kb = msvcrt.getch()
380
+
381
+
382
+
383
+ print(kb)
384
+
385
+
386
+
387
+ if kb.decode() == "a":
388
+
389
+
390
+
391
+ a()
392
+
393
+
394
+
395
+ elif kb.decode() == "b":
396
+
397
+
398
+
399
+ b()
400
+
401
+
402
+
403
+ elif kb.decode() == "c":
404
+
405
+
406
+
407
+ c()
408
+
409
+
410
+
411
+ elif kb.decode() == "d":
412
+
413
+
414
+
415
+ d()
416
+
417
+
418
+
419
+ elif kb.decode() == "e":
420
+
421
+
422
+
423
+ e()
424
+
425
+
426
+
427
+ elif kb.decode() == "f":
428
+
429
+
430
+
431
+ f()
432
+
433
+
434
+
435
+ elif kb.decode() == "g":
436
+
437
+
438
+
439
+ g()
440
+
441
+
442
+
443
+ elif kb.decode() == "h":
444
+
445
+
446
+
447
+ h()
448
+
449
+
450
+
451
+ elif kb.decode() == "i":
452
+
453
+
454
+
455
+ i()
456
+
457
+
458
+
459
+ elif kb.decode() == "j":
460
+
461
+
462
+
463
+ j()
464
+
465
+
466
+
467
+ elif kb.decode() == "k":
468
+
469
+
470
+
471
+ k()
472
+
473
+
474
+
475
+ elif kb.decode() == "l":
476
+
477
+
478
+
479
+ l()
480
+
481
+
482
+
483
+ elif kb.decode() == "m":
484
+
485
+
486
+
487
+ m()
488
+
489
+
490
+
491
+ elif kb.decode() == "n":
492
+
493
+
494
+
495
+ n()
496
+
497
+
498
+
499
+ elif kb.decode() == "o":
500
+
501
+
502
+
503
+ o()
504
+
505
+
506
+
507
+ elif kb.decode() == "p":
508
+
509
+
510
+
511
+ p()
512
+
513
+
514
+
515
+ elif kb.decode() == "q":
516
+
517
+
518
+
519
+ q()
520
+
521
+
522
+
523
+ elif kb.decode() == "r":
524
+
525
+
526
+
527
+ r()
528
+
529
+
530
+
531
+ elif kb.decode() == "s":
532
+
533
+
534
+
535
+ s()
536
+
537
+
538
+
539
+ elif kb.decode() == "t":
540
+
541
+
542
+
543
+ t()
544
+
545
+
546
+
547
+ elif kb.decode() == "u":
548
+
549
+
550
+
551
+ u()
552
+
553
+
554
+
555
+ elif kb.decode() == "v":
556
+
557
+
558
+
559
+ v()
560
+
561
+
562
+
563
+ elif kb.decode() == "w":
564
+
565
+
566
+
567
+ w()
568
+
569
+
570
+
571
+ elif kb.decode() == "x":
572
+
573
+
574
+
575
+ x()
576
+
577
+
578
+
579
+ elif kb.decode() == "y":
580
+
581
+
582
+
583
+ y()
584
+
585
+
586
+
587
+ elif kb.decode() == "z":
588
+
589
+
590
+
591
+ z()
592
+
593
+
594
+
595
+ elif kb.decode() == "0":
596
+
597
+
598
+
599
+ zero()
600
+
601
+
602
+
603
+ elif kb.decode() == "1":
604
+
605
+
606
+
607
+ one()
608
+
609
+
610
+
611
+ elif kb.decode() == "2":
612
+
613
+
614
+
615
+ two()
616
+
617
+
618
+
619
+ elif kb.decode() == "3":
620
+
621
+
622
+
623
+ three()
624
+
625
+
626
+
627
+ elif kb.decode() == "4":
628
+
629
+
630
+
631
+ four()
632
+
633
+
634
+
635
+ elif kb.decode() == "5":
636
+
637
+
638
+
639
+ five()
640
+
641
+
642
+
643
+ elif kb.decode() == "6":
644
+
645
+
646
+
647
+ six()
648
+
649
+
650
+
651
+ elif kb.decode() == "7":
652
+
653
+
654
+
655
+ seven()
656
+
657
+
658
+
659
+ elif kb.decode() == "8":
660
+
661
+
662
+
663
+ eight()
664
+
665
+
666
+
667
+ elif kb.decode() == "9":
668
+
669
+
670
+
671
+ nine()
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+ #Enterが押されたら終了
680
+
681
+ if kb.decode() == "\r":
682
+
683
+
684
+
685
+ sys.exit()
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+ #コマンドプロンプトで実行
700
+
701
+ if __name__ == "__main__":
702
+
703
+
704
+
705
+ blind_touch()
706
+
707
+ ```

1

誤字のため

2020/04/06 00:44

投稿

YProg
YProg

スコア67

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Pythonで作ったものをexe化して実行しているのですが,
6
6
 
7
- exeファイルの画面がメインでないときも実行し続ける方法はいでしょうか?
7
+ exeファイルの画面がメインでないときも実行し続ける方法はいでしょうか?
8
8
 
9
9
 
10
10