Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exapunks-hackmatch-bot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
exapunks-hackmatch-bot
Commits
efdf4ac5
Commit
efdf4ac5
authored
Apr 09, 2020
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable key listening to get rid of pynput dependency
parent
4af667da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
20 deletions
+0
-20
bot.py
bot.py
+0
-13
interaction.py
interaction.py
+0
-7
No files found.
bot.py
View file @
efdf4ac5
...
@@ -17,17 +17,6 @@ from strategy import State
...
@@ -17,17 +17,6 @@ from strategy import State
MAX_SPEED_ROWS
=
3
MAX_SPEED_ROWS
=
3
def
save_screenshot
(
win
):
board
=
screenshot_board
(
win
).
convert
(
'RGB'
)
os
.
makedirs
(
'screens'
,
exist_ok
=
True
)
for
i
in
count
(
1
):
path
=
'screens/board%d.png'
%
i
if
not
os
.
path
.
exists
(
path
):
print
(
'save screenshot in'
,
path
)
board
.
save
(
path
)
break
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
verbose
=
'-q'
not
in
sys
.
argv
[
1
:]
verbose
=
'-q'
not
in
sys
.
argv
[
1
:]
...
@@ -35,8 +24,6 @@ if __name__ == '__main__':
...
@@ -35,8 +24,6 @@ if __name__ == '__main__':
win
=
get_exapunks_window
()
win
=
get_exapunks_window
()
focus_window
(
win
)
focus_window
(
win
)
listen_keys
({
's'
:
lambda
:
save_screenshot
(
win
)})
buf
=
deque
([],
maxlen
=
3
)
buf
=
deque
([],
maxlen
=
3
)
def
vprint
(
*
args
,
**
kwargs
):
def
vprint
(
*
args
,
**
kwargs
):
...
...
interaction.py
View file @
efdf4ac5
...
@@ -71,15 +71,8 @@ def press_keys(window, keys):
...
@@ -71,15 +71,8 @@ def press_keys(window, keys):
time
.
sleep
(
KEY_DELAY
/
1000
)
time
.
sleep
(
KEY_DELAY
/
1000
)
def
listen_keys
(
handlers
):
from
pynput
import
keyboard
def
handler
(
keycode
):
key
=
str
(
keycode
).
replace
(
'
\
'
'
,
''
)
if
key
in
handlers
:
handlers
[
key
]()
keyboard
.
Listener
(
on_release
=
handler
).
start
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment