Skip to content
Related Articles

Related Articles

Build an Application to Search Installed Application using Python
  • Last Updated : 15 Feb, 2021

Prerequisite – Tkinter in Python.

In this article, we are going to write python scripts to search for an installed application on Windows and bind it with the GUI application. We are using winapps modules for managing installed applications on Windows.

To install the module, run this command in your terminal:

pip install winapps

Below is what the GUI looks like:-



Methods used  from winapps module

To print installed applications, the winapps module has winapps.list_installed() method. T

Python3




# import modules
import winapps
 
# get each application with list_installed()
for item in winapps.list_installed():
    print(item)

 
 

Output:

 

InstalledApplication(name=’Mi Smart Share’, version=’1.0.0.452′, install_date=None, install_location=None, install_source=None, modify_path=None, publisher=’Xiaomi Inc.’, uninstall_string=’C:\\Program Files\\MI\\AIoT\\MiShare\\1.0.0.452\\Uninstall.exe’)
 

InstalledApplication(name=’Git version 2.27.0′, version=’2.27.0′, install_date=datetime.date(2020, 7, 22), install_location=WindowsPath(‘D:/Installation_bulk/Git’), install_source=None, modify_path=None, publisher=’The Git Development Community’, uninstall_string='”D:\\Installation_bulk\\Git\\unins000.exe”‘)
 



InstalledApplication(name=’Microsoft 365 – en-us’, version=’16.0.13127.20408′, install_date=None, install_location=WindowsPath(‘C:/Program Files/Microsoft Office’), install_source=None, modify_path='”C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\OfficeClickToRun.exe” scenario=repair platform=x64 culture=en-us’, publisher=’Microsoft Corporation’, uninstall_string='”C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\OfficeClickToRun.exe” scenario=install scenariosubtype=ARP sourcetype=None productstoremove=O365HomePremRetail.16_en-us_x-none culture=en-us version.16=16.0′)
 

InstalledApplication(name=’On Screen Display Utility’, version=’1.0.0.140′, install_date=None, install_location=None, install_source=None, modify_path=None, publisher=’Xiaomi Inc.’, uninstall_string=’C:\\Program Files\\MI\\OSD Utility\\1.0.0.140\\Uninstall.exe’)
 

InstalledApplication(name=’Intel(R) Management Engine Components’, version=’1921.14.0.1280′, install_date=None, install_location=WindowsPath(‘C:/Program Files (x86)/Intel/Intel(R) Management Engine Components’), install_source=None, modify_path=None, publisher=’Intel Corporation’, uninstall_string='”C:\\ProgramData\\Intel\\Package Cache\\{1CEAC85D-2590-4760-800F-8DE5E91F3700}\\Setup.exe” -uninstall’)
 

………
 

 

For searching the existing applications, the module has search_installed(‘App_name’) method.

 

Python3




for item in winapps.search_installed('chrome'):
    print(item)

 
 

Output:

 

InstalledApplication(name=’Google Chrome’, version=’85.0.4183.102′, install_date=datetime.date(2020, 9, 11),
install_location=WindowsPath(‘C:/Program Files (x86)/Google/Chrome/Application’), install_source=None, 
modify_path=None, publisher=’Google LLC’, uninstall_string=’
“C:\\Program Files (x86)\\Google\\Chrome\\Application\\85.0.4183.102\\Installer\\setup.exe” 
–uninstall –system-level –verbose-logging’)
 

Searching application in windows using Tkinter

 

Python3




# import modules
from tkinter import *
import winapps
 
# funtion to attach output
def app():
 
    for item in winapps.search_installed(e.get()):
        name.set(item.name)
        version.set(item.version)
        Install_date.set(item.install_date)
        publisher.set(item.publisher)
        uninstall_string.set(item.uninstall_string)
 
 
# object of tkinter
# and background set for grey
master = Tk()
master.configure(bg='light grey')
 
# Variable Classes in tkinter
name = StringVar()
version = StringVar()
Install_date = StringVar()
publisher = StringVar()
uninstall_string = StringVar()
 
 
# Creating label for each information
# name using widget Label
Label(master, text="Enter App name : ",
      bg="light grey").grid(row=0, sticky=W)
Label(master, text="Name : ",
      bg="light grey").grid(row=2, sticky=W)
Label(master, text="Version :",
      bg="light grey").grid(row=3, sticky=W)
Label(master, text="Install date :",
      bg="light grey").grid(row=4, sticky=W)
Label(master, text="publisher :",
      bg="light grey").grid(row=5, sticky=W)
Label(master, text="Uninstall string :",
      bg="light grey").grid(row=6, sticky=W)
 
 
# Creating lebel for class variable
# name using widget Entry
Label(master, text="", textvariable=name,
      bg="light grey").grid(row=2, column=1, sticky=W)
Label(master, text="", textvariable=version,
      bg="light grey").grid(row=3, column=1, sticky=W)
Label(master, text="", textvariable=Install_date,
      bg="light grey").grid(row=4, column=1, sticky=W)
Label(master, text="", textvariable=publisher,
      bg="light grey").grid(row=5, column=1, sticky=W)
Label(master, text="", textvariable=uninstall_string,
      bg="light grey").grid(row=6, column=1, sticky=W)
 
 
e = Entry(master, width=30)
e.grid(row=0, column=1)
 
# creating a button using the widget
b = Button(master, text="Show", command=app, bg="Blue")
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5,)
 
mainloop()

Output:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :