質問編集履歴
3
s
title
CHANGED
File without changes
|
body
CHANGED
@@ -68,4 +68,7 @@
|
|
68
68
|
# 押した時のみ
|
69
69
|
with Listener(Key_press= Key_press) as listener:listener.join()
|
70
70
|
|
71
|
-
```
|
71
|
+
```
|
72
|
+
|
73
|
+
#参考にした公式サイトです
|
74
|
+
https://pypi.org/project/pynput/
|
2
追記と修正=t,s
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
pynput キーワードを式にできない。
|
1
|
+
pynput キーワードを式にできない。 反応しない。
|
body
CHANGED
@@ -39,4 +39,33 @@
|
|
39
39
|
|
40
40
|
|
41
41
|
Key_operation.When_pushed()
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
#
|
46
|
+
そもそも、実行できてませんでした。
|
47
|
+
原因は何でしょうか?
|
48
|
+
|
49
|
+
```python
|
50
|
+
|
51
|
+
from pynput.keyboard import Key, Listener
|
52
|
+
|
53
|
+
def Key_press(key):
|
54
|
+
|
55
|
+
try:
|
56
|
+
print(key.char)
|
57
|
+
except AttributeError:
|
58
|
+
print(key)
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
def Key_release(key):
|
63
|
+
print(key)
|
64
|
+
|
65
|
+
if key == Key.esc:
|
66
|
+
return False
|
67
|
+
|
68
|
+
# 押した時のみ
|
69
|
+
with Listener(Key_press= Key_press) as listener:listener.join()
|
70
|
+
|
42
71
|
```
|
1
t
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
```python
|
9
|
+
from pynput import keyboard
|
10
|
+
|
9
11
|
class Key_operation:
|
10
12
|
|
11
13
|
r=[] #キー入力用 押す
|