The Wayback Machine - https://web.archive.org/web/20241001191239/https://www.geeksforgeeks.org/build-an-application-to-search-installed-application-using-python/
Open In App

Build an Application to Search Installed Application using Python

Last Updated : 30 Nov, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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.

Prerequisite – Tkinter in Python

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

pip install winapps

Below is what the GUI looks like as follows: 

Methods used  from winapps module

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

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
 
# function 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 label 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:

 Code Explanation:

  1. The code starts by importing the modules that are needed for this program.
  2. The next line is a function called app() which will be used to run the main loop of the program.
  3. This function starts with a for loop that iterates through all of the items in winapps.search_installed().
  4. Each item has an attribute set, and then its name, version, install date, publisher, and uninstall string are all set accordingly.
  5. The last line creates an object called Analyze which contains all of these attributes as well as some other ones like how many times it was installed and when it was uninstalled last time.
  6. The code attempts to create a GUI that will allow the user to search for installed software on their computer.
  7. The code creates an object of tkinter and then imports winapps, which is a module that contains all of the information about installed software.
  8. The app() function is called when the GUI starts up and it iterates through each item in winapps.search_installed().
  9. It sets values for name, version, install_date, publisher, uninstall_string.
  10. The code starts by creating a master window with the name “master”.
  11. The background color of this window is set to grey.
  12. Next, we create three variables: name, version, and Install_date.
  13. These are all StringVar objects that store text values.
  14. The next line creates a Label widget on the master window with the text “Enter App Name :” in light grey as its background color.
  15. This label will be placed at row 0 and will have sticky w’s enabled so it can’t move from its position when you drag it around using your mouse pointer.
  16. Next, two more labels are created for each variable: one for displaying their names (label named “name”) and one for displaying their versions (label named “version”).
  17. They’re both placed at row 2 because they need to be above the first label which displays Enter App Name : .
  18. Sticky w’s are also enabled here so they won’t move out of place when you drag them around using your mouse pointer either.
  19. Finally, a fourth label is created called Install Date which has a light grey background color like all other labels in this program except for the last one which has no background color specified yet but instead uses an implicit default value of white since there
  20. The code is a tkinter script that creates labels on the master window.
  21. The code starts by creating a widget called Entry.
  22. The widget is created with the master and width properties set to 30.
  23. Next, the code creates a label for class variable name using widget Entry.
  24. Label(master, text=””, textvariable=name, bg=”light grey”).grid(row=2, column=1, sticky=W) creates a label that will be placed in row 2 of column 1 on the master window.
  25. The text variable is set to “”.
  26. This means that there will be no text displayed on this label because it has been given an empty string as its value for its textvariable property (textvariable).
  27. The next line of code creates another label for class variable version using widget Entry.
  28. Label(master, text=””, textvariable=version, bg=”light grey”).grid(row=3, column=1, sticky=W) creates another label that will be placed in row 3 of column 1 on the master window.
  29. The text variable is set to “”.
  30. This means that there will be no text displayed on this label because it has been given an empty string as its value for its textvariable property (textvariable).
  31. The code is the most basic example of a widget.
  32. The code creates a label for class variable name using widget Entry.
  33. The master is the parent widget and textvariable=name is the child widget.
  34. The bg=”light grey” parameter sets the background color to light grey.
  35. The grid() function arranges widgets in rows and columns, with row=2, column=1, and sticky=W as shown above.


Previous Article
Next Article

Similar Reads

Get a List of Installed Softwares in Windows using Python
In this article, we are going to write a Python script to get the installed software list in windows. We will use the subprocess module to interact with cmd and to retrieve information into your Python IDE. We can read the cmd command through the subprocess module. Let's see the logic, if we run this wmic product get name code into our terminal the
1 min read
Find Installed Python Package Version Using Pip
When working on Python projects, it’s common to rely on third-party libraries and packages. Knowing which version of a package is installed is crucial, especially when our project depends on specific features or when we need to ensure compatibility with other packages. This article will guide us through several methods to find the version of a pack
2 min read
How to Check If Python Package Is Installed
In this article, we are going to see how to check if Python package is installed or not. Check If Python Package is InstalledThere are various methods to check if Python is installed or not, here we are discussing some generally used methods for Check If Python Package Is Installed or not which are the following. By using Exception handlingBy using
5 min read
Check Version of Installed Python Modules
In Python, managing packages is an essential part of the development process. Knowing the version of the package that is currently installed can help us to ensure compatibility and debug issues effectively in our python code. In this article, we will explore methods to determine the version of packages installed in our current working python enviro
2 min read
How To List Installed Python Packages
Working on Python projects may require you to list the installed Python packages in order to manage dependencies, check for updates, or share project requirements with others. In this post, we'll look at numerous techniques for listing the Python packages that are installed on your system. List Installed Python Packages Below are some methods by wh
5 min read
How to check NumPy version installed?
In this article, we are going to learn how we can find out which version of NumPy your Python code uses. The version of any project keeps on changing with time as the project gets updated, new features keep being added, and old bugs are removed. Hence, a lot of work keeps on happening on projects especially one like NumPy which is a very popular Py
2 min read
Build a GUI Application to Get Live Stock Price using Python
The stock price is the highest amount someone is willing to pay for the stock. In this article, we are going to write code for getting live share prices for each company and bind it with GUI Application. Module Needed Yahoo_fin: This module is used to scrape historical stock price data, as well as to provide current information on market caps, divi
3 min read
Build an Application to extract URL and Metadata from a PDF using Python
The PDF (Portable Document Format) is the most common use platform-independent file format developed by Adobe to present documents. There are lots of PDF-related packages for Python, one of them is the pdfx module. The pdfx module is used to extract URL, MetaData, and Plain text from a given PDF or PDF URL. Features: Extract references and metadata
3 min read
Build a GUI Application to get distance between two places using Python
Prerequisite: Tkinter In this article, we are going to write a python script to get the distance between two places and bind it with the GUI application. To install the GeoPy module, run the following command in your terminal. pip install geopy Approach used: Import the geopy module.Initialize Nominatim API to get location from the input string.Get
2 min read
Build an Application for Changing PC's Wallpaper using Python
Prerequisite: Python GUI – tkinter In this article, we are going to write a script for background changing application using the py-wallpaper module in Python. The py-wallpaper module is used to change the background wallpaper. Before starting we need to install py-wallpaper. Installation: To install this type the below command in the terminal. pip
2 min read
Build an Application for Screen Rotation Using Python
In this article, we are going to write a python script for screen rotation and implement it with GUI. The display can be modified to four orientations using some methods from the rotatescreen module, it is a small Python package for rotating the screen in a system. Installation:pip install rotate-screenApproach: Step 1) Import the required module i
2 min read
Build an Application to extract news from Google News Feed Using Python
Prerequisite- Python tkinter In this article, we are going to write a python script to extract news articles from Google News Feed by using gnewsclient module and bind it with a GUI application. gnewsclient is a python client for Google News Feed. This API has to installed explicitly first in order to be used. Installation The following terminal co
2 min read
Build an GUI Application to Get Live Air Quality Information Using Python.
We are living in a modernization and industrialization era. Our life becomes more and more convenient. But the problem is Air Pollution arise with time. This Pollution makes us unhealthy, Air is a Lifeline for our life. In this article, we are going to write python scripts to get live air quality information and bind it with GUI Application. Module
5 min read
Build a GUI Application to ping the host using Python
Prerequisite: Python GUI – Tkinter In this article, we are going to see how to ping the host with a URL or IP using the python ping module in Python. This module provides a simple way to ping in python. And It checks the host is available or not and measures how long the response takes. “Before” starting we need to install this module into your sys
2 min read
Build GUI Application for Guess Indian State using Tkinter Python
In this article, you will learn to make a GUI game in Python, in which we will be shown a map of Indian states and an input prompt were in the prompt, the user has to enter a state name of India. If the user guessed it correctly, the name would hover over its location on the map. You can also see the score as the title of the input prompt window. M
8 min read
Build a To-Do application Using Django, React and Tailwind
This article will guide you in creating a To-Do application using React and Tailwind with the Django Framework. We’ll explore the integration of Django, React, and Tailwind, and go through the step-by-step process of implementing the To-Do application. What is a To-Do application?A To-Do application, also known as a task management or productivity
6 min read
Build a Clock Application using Django and React
The clock project aims to develop a simple yet functional clock application using modern web technologies. It combines the frontend capabilities of React.js for creating dynamic user interfaces with the styling power of Tailwind CSS for a sleek and responsive design. Additionally, the backend is built using Django, providing a robust framework for
4 min read
Build an Application to translate English to Hindi in Python
In these articles, We will write python scripts to translate English word to Hindi word and bind it with the GUI application. We are using the English-to-Hindi module to translate the English word into the Hindi word. Installation: Run this code into your terminal: pip install englisttohindi Approach: Import English to Hindi modules.Create an objec
2 min read
Build GUI Application Pencil Sketch from Photo in Python
In this article, we will cover how to convert images to watercolor sketches and pencil sketch Linux. Sketching and painting are used by artists of many disciplines to preserve ideas, recollections, and thoughts. Experiencing art from painting and sculpting to visiting an art museum—provides a variety of well-being advantages, including reduced stre
5 min read
GUI application to search a country name from a given state or city name using Python
In these articles, we are going to write python scripts to search a country from a given state or city name and bind it with the GUI application. We will be using the GeoPy module. GeoPy modules make it easier to locate the coordinates of addresses, cities, countries, landmarks, and Zipcode. Before starting we need to install the GeoPy module, so l
2 min read
Build a Flask application to validate CAPTCHA
In this article, we are going a build a web application that can have a CAPTCHA. CAPTCHA is a tool you can use to differentiate between real users and automated users. CAPTCHAs are usually found on the login pages or on payment pages. What is CAPTCHA? Captcha is strategy used to ensure sites against spam. Objective is to prevent intuitive sites fro
5 min read
Python | Build a REST API using Flask
Prerequisite: Introduction to Rest API REST stands for REpresentational State Transfer and is an architectural style used in modern web development. It defines a set or rules/constraints for a web application to send and receive data. In this article, we will build a REST API in Python using the Flask framework. Flask is a popular micro framework f
3 min read
Build a simple Quantum Circuit using IBM Qiskit in Python
Qiskit is an open source framework for quantum computing. It provides tools for creating and manipulating quantum programs and running them on prototype quantum devices on IBM Q Experience or on simulators on a local computer. Let's see how we can create simple Quantum circuit and test it on a real Quantum computer or simulate in our computer local
5 min read
Build a Virtual Assistant Using Python
Virtual desktop assistant is an awesome thing. If you want your machine to run on your command like Jarvis did for Tony. Yes it is possible. It is possible using Python. Python offers a good major library so that we can use it for making a virtual assistant. Windows has Sapi5 and Linux has Espeak which can help us in having the voice from our machi
8 min read
Build a basic Text Editor using Tkinter in Python
Tkinter is a Python Package for creating GUI applications. Python has a lot of GUI frameworks, but this is the only framework that’s built into the Python standard library. It has several strengths; it’s cross-platform, so the same code works on Windows, macOS, and Linux. It is lightweight and relatively painless to use compared to other frameworks
4 min read
Build a COVID19 Vaccine Tracker Using Python
As we know the world is facing an unprecedented challenge with communities and economies everywhere affected by the COVID19. So, we are going to do some fun during this time by tracking their vaccine. Let's see a simple Python script to improve for tracking the COVID19 vaccine. Modules Neededbs4: Beautiful Soup(bs4) is a Python library for pulling
2 min read
Build Fuel Price Tracker Using Python
In this modern-day lifestyle, fuel has become a necessity for all human beings. It is a base for our life-style. So, we are going to write a script to track their price using Python. Modules Needed bs4: Beautiful Soup(bs4) is a Python library for pulling data out of HTML and XML files. This module does not come built-in with Python. To install this
3 min read
Build a Voice Recorder GUI using Python
Prerequisites: Python GUI – tkinter, Create a Voice Recorder using Python Python provides various tools and can be used for various purposes. One such purpose is recording voice. It can be done using the sounddevice module. This recorded file can be saved using the soundfile module Module NeededSounddevice: The sounddevice module provides bindings
2 min read
How to Build a WiFi Scanner in Python using Scapy?
In this article, we are going to build a WiFi Scanner in Python using Scapy. WiFi Scanning or Network scanning refers to the scanning of the whole network to which we are connected and try to find out what are all the clients connected to our network. We can identify each client using their IP and MAC address. We can use ARP ping to find out the al
3 min read
How to build a Random Story Generator using Python?
In this section, we are going to make a very interesting beginner-level project of Python. It is a random story generator. The random story generator project aims to generate random stories every time user executes the code. A story is made up of a collection of sentences. We will choose random phrases to build sentences, and hence stories. Now, th
4 min read