#๐Ÿ”’ Simple hotkey creator. Need help/idea's

61 messages ยท Page 1 of 1 (latest)

proper jewelBOT
#

@wide berry

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

rocky sparrow
#

keyboard.add_hotkey

#

if the original message is deleted bc there is no longer an issue use !solved or !close

#

else u prob need

#

!paste

proper jewelBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

wide berry
#

Hey I'm a beginner in programming. I'm currently trying to make a simple program that can manage your custom made hotkeys around Windows OS.
The program works but It's missing an important function.
The issue: I'm having trouble figuring out how can I make my program work with multiple hotkey combinations so far I was only able to assign a single key for
a specific action.
Would love to hear your ideas/solutions. Thanks

wide berry
#

i mean the url you sent me

rocky sparrow
#

works for me

wide berry
#

here we go

rocky sparrow
#

ok thats quite long i would think ur error is that u dont make new threads and one hotkey blocks the others

#

keyboard.hotkey("a+b",funcs)
runs the func function when a and b are pressed

#

it works like a charm u should use that

#

it also can handle multiple cobos at once

#

problem is idk how u delete a mapping after it exists in any other way than restarting the whole code

wide berry
#

now i made it so it stay's

wide berry
rocky sparrow
wide berry
#

Did you get to pen the program?

#

open*

rocky sparrow
#

yes

wide berry
#

Im not sure im following what will the issue be sorry im not that experienced

rocky sparrow
#

so the way u register hotkeys to work is by saying keyboard.add_hotkey(hotkey,action)

#

than the hotkeys should work no matter how many there are

#

also that load_hotkeys wont work u need to eiter readlines or read and than split at \n

rocky sparrow
#

wierd u shouldnt be able to iter IO streems

wide berry
#

maybe with your solution won't work you mean?

rocky sparrow
#

replace the setup_hotkey_listener(self)s
contents with:
for hotkey, command in self.hotkeys: keyboard.add_hotkey(hotkey, command)

#

u need to pip install the keyboard module and import it

wide berry
rocky sparrow
#

the hotkey is a + sepearated str of chars where Space= Shift=shift ...

rocky sparrow
wide berry
#

can this stay? from pynput.keyboard import Key

rocky sparrow
#

Bc the name keyboard is not imported only key is imported from it yes

#

Also u can do
Import keyboard as kb or idk so it has a different name

wide berry
#

can I do it like this

from pynput import keyboard

rocky sparrow
#

No bc one will over write the other

#

U can import one of them on a different name with as

#

Like import keyboard as kb

#

That imports keyboard but it will actually be under the name kb not keyboard

wide berry
#

ye but it still glow's yellow ๐Ÿฅฒ

rocky sparrow
#

Also im going to sleep so if im un responsive u know i won't be for a while

wide berry
#

Ok thank you for the help โค๏ธ

rocky sparrow
wide berry
#

ModuleNotFoundError: No module named 'keyboard'

rocky sparrow
#

U pip installed right?

wide berry
#

yup

#

should i reinstall?

#

sometimes works

rocky sparrow
#

Shit u have pip errors im to tierd for this

#

Im consider myself an expert at them tho sho ping me tomorrow and ill try to get it fixed for u

wide berry
#

go to sleep if you need to I appreciate the help

rocky sparrow
#

Bye np

proper jewelBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.