im trying to find/write a simple daemon in python (preferably) to play a sound on every key pressed, for usability purposes. Something like this https://www.grc.com/freeware/clickey.htm but for Linux.
Ive found some codes around but still cannot put them together. If you guys could point me in the right direction, it would be great
Thanks for your help.
I think this will give you easiest work around:
http://www.speech.kth.se/snack/
After this you can use following code:
s = Sound()
s.read('mymusic.mp3')
s.play()
Good thing is that it works on both windows and linux.
I've found the Qwertickle typewriter sound scheme pretty easy to learn and modify for own needs. Here is my version with pc keyboard sounds :)
Related
I have a question, is it possible to use python to make it so that when pressing the right mouse button, some key on the keyboard is pressed (for example, the G key)
Not sure if this is the best place to ask such question but I'll answer and whatever happens to the thread happens.
From my experience, I think the easiest and most accessible module for keyboard control would be 'keyboard' by BoppreH. I've used it and had no issues. Good cross-platform choice for Windows and Linux, if that's a consideration.
Here are a couple of resources. Should be easy enough to integrate.
A friendly suggestion for next time, friend. Please try looking online first. Happy Coding :)
https://pypi.org/project/keyboard/
https://github.com/boppreh/keyboard
I am new-ish to python, so bear with me here.
I would like to make an autoclicker that would work on any device with IDLE, if I copy/paste the code, whether or not it has extra libraries (modules?) tacked on.
If it helps, this is for a 2014 MacBook Air.
Ideally, it would look something like this:
if key is pressed:
active = True
while active is True:
(simulate mouse click)
I've seen a similar question, but everyone suggested PyAutoGUI, which is not in the standard library.
I'm not sure whether it's possible to do this, however.
It's pretty simple, except I have no idea how to actually do it.
Note : I am pretty surprised I did not see that same question on this forum, if I missed it please link in comment :)
I am writing a bot in python that would eventually be able to play a browser-based video game (HTML5 canvas game, not Flash). In order to do that I need to simulate the keyboard events from the python code.
I thought pyautogui would do the work, but unfortunately it seems the only way to repeat a key is to do pyautogui.press(key) in a loop, and it is not good at all for playing games as the move is not smooth at all.
I found some solutions for Windows, but I need a solution for macOSX.
Generally I want to write a program to run in the background on Mac and when I push a keyboard shortcut, the current active window would be resized and positioned to the way I have set.
Something similar to the tool called SizeUp on Mac. I think this shouldn't be difficult to implement and would be fun to take a try.
I would appreciate any resources you could point me to. Thanks.
I think you're going to have an easier time attacking this in applescript. Upon casual googling, this link seems to have more or less what you want. If you were more looking for a programming challenge in python, and less for a solution, then disregard this.
I was wondering if anyone knows how to import a sprite and let it move when pressing the arrow keys in python, without using pygame, or some other library. This is purely out of curiosity, because I was just thinking about some sort of personal challenge, and that's what came to mind: a python game, without the help of pygame or libtcod. Is this possible, or do you need a library to do this for you? I'd appreciate anyone's input on this one.
Thanks.
What comes to my mind is using Tkinter's Canvas class. It is quite possible to do a simple program like that described using bindings on this class.
A good example of this may be found in Mark Lutz's Programming Python (http://shop.oreilly.com/product/9780596158118.do), the Moving Pics example.
If you don't own this, you can still look at the code for it as a reference by downloading the code using the link on the right side of the page. The path to the appropriat folder is /PP4E-Examples-1.3.1/Examples/PP4E/Gui/MovingPics/.