Pygame+Laptop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Pygame+Laptop

Story: (Not necessary to read) I've used Pygame for few months and I felt very familiar with it using Pydroid3. Now I have a laptop, which runs Windows 10, I downloaded Python 3.7 from python.org and downloaded pygame 1.9.4 through a preinstalled command promth. It differs only a little from like it was in Pydroid3. Problem: I can't use the mouse or the key submodules, I've tried: pygame.mouse.get_pressed() pygame.key.get_pressed() But they don't take input from keyboard nor mouse pad, which are both built in to my laptop. pygame.mouse.get_pressed() works somehow on Pydroid3 for touch screen. Should I get a real mouse and keyboard? What can be the problem?

25th Jan 2019, 7:59 PM
Seb TheS
Seb TheS - avatar
3 Answers
+ 2
You need an event listener. pygame.event.get() After this method you are able to use controls including your builtin mouse pad and keyboard. Not separate mouse or keyboard is needed.
29th Jan 2019, 12:57 PM
Seb TheS
Seb TheS - avatar
+ 6
This is gold 😂😂. 👍
17th Mar 2019, 1:10 PM
Morpheus
Morpheus - avatar
+ 1
@Seb TheS It worked! Thanks alot!
29th Jan 2019, 12:58 PM
Seb TheS
Seb TheS - avatar