Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

With tkinter how can I make it install python packages

I would like to make a python program that automatically installs python packages, how do I get python to press enter inside of command prompt?

def pyautogui():
    subprocess.Popen("cmd")
    print('pip install pyautogui')
    keyboard.press('Enter')

#pyautogui
pyag = Button(root, text ="PyAutoGui", command=pyautogui)
pyag.grid()

This is the basic of what I got but for whatever reason the  keyboard module won't hit enter inside of command  prompt.

Link to post
Share on other sites

Don't use tkinter or try to visually recreate the user interface. Instead, just send commands directly through to the os (which will also allow it to work cross platform).

print('Installing pyautogui...')
os.system('pip install pyautogui')

 

Link to post
Share on other sites

I'm using tkinter to make a menu and when I click on pyautogui, or any other python packages I put in their. it will install them by just clicking a button. So I need to make the user interface. So I'm still wondering how I get the interface to talk to command prompt.

Link to post
Share on other sites
1 minute ago, Enderg312 said:

I'm using tkinter to make a menu and when I click on pyautogui, or any other python packages I put in their. it will install them by just clicking a button. So I need to make a user interface.

Have the button event handler call os.system() instead then.

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

×