Jump to content

Python Hotkeys

So I'm fairly new to python and for boredom and practical purposes I want to make a programme that starts up on launch and opent a .exe file upon keypress. I have already looked at plenty of tutorials and I can't get pip to work to download py2exe to make the programme. At this point I don't know what I'm writing but I NEED HELP

MSI RX 570 8GB | i7 3370 @3.4/3.8  |  MS Spectrum  |  120GB OCZ VERT3X SSD  | Seagate 1TB SSHD |

 

Link to comment
Share on other sites

Link to post
Share on other sites

Well... it really helps if you show the code that's failing, and the error output you're getting... 

Pip not working can be a result of many things. We can't answer without that info

Main Rig: R9 5950X @ PBO, RTX 3090, 64 GB DDR4 3666, InWin 101, Full Hardline Watercooling

Server: R7 1700X @ 4.0 GHz, GTX 1080 Ti, 32GB DDR4 3000, Cooler Master NR200P, Full Soft Watercooling

LAN Rig: R5 3600X @ PBO, RTX 2070, 32 GB DDR4 3200, Dan Case A4-SFV V4, 120mm AIO for the CPU

HTPC: i7-7700K @ 4.6 GHz, GTX 1050 Ti, 16 GB DDR4 3200, AliExpress K39, IS-47K Cooler

Router: R3 2200G @ stock, 4GB DDR4 2400, what are cases, stock cooler
 

I don't have a problem...

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah ,see I sort of plugged my PC out after 2 days of tinkering with this...But it was showing an error in cmd where it stopped. C:/Python37/Scripts>pip install py2exe .That may not be exactly what I had typed but it was showing an error in the "Python37/Scripts" part as it couldn't find it

MSI RX 570 8GB | i7 3370 @3.4/3.8  |  MS Spectrum  |  120GB OCZ VERT3X SSD  | Seagate 1TB SSHD |

 

Link to comment
Share on other sites

Link to post
Share on other sites

Not sure why you're needing py2exe to achieve this. I actually have a sample program lying around I wrote myself for key-presses:

import win32api, win32con, time
from pynput import keyboard

def on_release(key):
    if key == keyboard.Key.esc:
        # Kill listener
        return False
    if key == 'your key':
        #open file
        return True

with keyboard.Listener(
        on_release=on_release) as listener:
    listener.join()

Just install the dependencies and you'll be good to go. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×