X Tutup
Skip to content

Commit 7746edb

Browse files
committed
pysdl2 example complete.
1 parent 1bc4d7f commit 7746edb

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

Authors

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Greg Farrell <gregfarrell.org@@gmail.com>
1313
Finn Hughes <finn.hughes1@@gmail.com>
1414
Marcelo Fernandez <fernandezm@@gmail.com>
1515
Simon Hatt <9hatt2@@gmail.com>
16+
Neil Munday <www.mundayweb.com>

examples/pysdl2.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
Only handles mouse events but could be extended to handle others.
55
66
Requires pysdl2 (and SDL2 library).
7+
8+
Tested configurations:
9+
- SDL2 2.0.5 with PySDL2 0.9.3 on Fedora 25 (x86_64)
10+
- SDL2 with PySDL2 0.9.5 on Ubuntu 14.04
711
812
Install instructions.
913
@@ -20,16 +24,17 @@
2024
2. Install PySDL via PIP:
2125
2226
sudo pip2 install PySDL2
23-
24-
Tested configurations:
25-
- SDL2 2.0.5 with PySDL2 0.9.3 on Fedora 25 (x86_64)
26-
- SDL2 with PySDL2 0.9.5 on Ubuntu 14.04
2727
2828
Event handling:
2929
3030
Where possible SDL2 events are mapped to CEF ones. Not all keyboard
3131
modifiers are handled in this example but these could be
32-
add by the reader (if desired).
32+
added by the reader (if desired). Modifiers that do not work
33+
for example:
34+
35+
- Ctrl
36+
- Mouse dragging
37+
- Marking text inputs with the shift key
3338
3439
Due to SDL2's lack of GUI widgets there are no GUI controls
3540
for the user. However, as an exercise this example could
@@ -265,7 +270,10 @@ def getKeyCode(key):
265270
if key in keyMap:
266271
return keyMap[key]
267272
# Key not mapped, raise exception
268-
print("Keyboard mapping incomplete: unsupported SDL key %d. See https://wiki.libsdl.org/SDLKeycodeLookup for mapping." % key)
273+
print("Keyboard mapping incomplete: \
274+
unsupported SDL key %d. \
275+
See https://wiki.libsdl.org/SDLKeycodeLookup for mapping."
276+
% key)
269277
return None
270278

271279
class LoadHandler(object):

0 commit comments

Comments
 (0)
X Tutup