Exploring Windows App Management with Python's Winapps Library

winapps is a third-party Python package that provides a simple API to get information about the installed applications on a Windows machine.

The "winapps" package can be used to get a list of all installed applications, their publisher, version, and installation date. It can also be used to launch an application, get the command-line arguments used to launch an application, and get the process ID of a running application.

Step-by-Step Guide: Installing and Utilizing Winapps in Python for Seamless Application Management

You can install the "winapps" package using pip, which is the standard package manager for Python. Here are the steps to install and use "winapps" in Python:

  1. Open a command prompt or terminal window.
  2. Type the following command to install the "winapps" package:
  3. pip install winapps                          
    
    

    This command will download and install the "winapps" package and its dependencies.

  4. Once the "winapps" package is installed, you can use it in your Python code. Here's an example of how to use it to get a list of all installed applications on a Windows machine:
  5. from winapps import AppList
    
    apps = AppList()
    for app in apps:
        print(app.name, app.version, app.publisher, app.install_date)                          
    
    

This code will print out the name, version, publisher, and installation date of each installed application.

*Note that the "winapps" package is designed to work only on Windows machines, so if you try to use it on a non-Windows machine, you will get an error.

Complete Guide: Creating a Windows Installed Apps Details Query GUI using Python Tkinter and Winapps Library

In this app, the process begins by utilizing the Python Tkinter framework to create a graphical user interface (GUI) for the Windows Installed Apps Details Query application. Tkinter provides the necessary tools and widgets to design an intuitive and user-friendly interface.

Next, the application incorporates the Winapps library, which allows seamless interaction with the Windows operating system and its installed applications. By leveraging the Winapps library's functionalities, the application gains the ability to access information about the installed apps on the system.

When the user interacts with the GUI, such as clicking a button or entering search criteria, the application triggers the appropriate functions. These functions utilize the Winapps library to retrieve the desired information from the Windows operating system.

The retrieved data, which includes details about the installed apps, such as names, versions, publishers, and installation dates, is then displayed on the GUI for the user to view.

Here's a breakdown of each section:

Imports the necessary modules for the program to work: Tkinter and winapps.

from tkinter import *
import winapps

Defines a function app() that gets called when the "Show" button is pressed. It searches for an installed application based on the name entered in the Entry widget (e), and sets the values of the StringVar objects name, version, Install_date, publisher, and uninstall_string with the corresponding values of the winapps.App object that matches the entered name.

# 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)

Creates a Tkinter object master that represents the main window of the GUI.

# an object of tkinter 
master = Tk()
# set background color
master.configure(bg='old lace')

Defines StringVar objects for each piece of information that will be displayed about the application. These are used to set the values of the corresponding Label widgets in Section 6.

# variable classes in tkinter 
name = StringVar()
version = StringVar()
Install_date = StringVar()    
publisher = StringVar()
uninstall_string = StringVar()

Creates Label widgets that display descriptive text for each piece of information about the application. The grid() method is used to place them in the appropriate rows and columns of the window.

# creating label for each information and grid method to place them  
Label(master, text="Enter App Name : ", font="arial 10 bold", bg="old lace").grid(row=0, sticky=W)

Label(master, text="Name :" ,bg="old lace").grid(row=2, sticky=W)
Label(master, text="Version :",bg="old lace").grid(row=3, sticky=W)
Label(master, text="Install Date :",bg="old lace").grid(row=4, sticky=W)
Label(master, text="Publisher :" ,bg="old lace").grid(row=5, sticky=W)
Label(master, text="Uninstall String :" ,bg="old lace").grid(row=6, sticky=W)

Creates Label widgets that display the actual values of the application information. The textvariable parameter is used to set the value of each Label to the corresponding StringVar object defined in Section 4. These Label widgets are also placed in the appropriate rows and columns of the window using the grid() method.

# creating label for class variable name using widget Entry
Label(master, text="", textvariable=name, bg="coral").grid(row=2, column=1, sticky=W)
Label(master, text="", textvariable=version, bg="aqua").grid(row=3, column=1, sticky=W)
Label(master, text="", textvariable=Install_date, bg="bisque").grid(row=4, column=1, sticky=W)
Label(master, text="", textvariable=publisher, bg="yellow").grid(row=5, column=1, sticky=W)  
Label(master, text="", textvariable=uninstall_string, bg="teal").grid(row=6, column=1, sticky=W)

Creates an Entry widget (e) that allows the user to enter the name of the application they want to search for. This widget is placed in the first row and second column of the window using the grid() method.

e = Entry(master, width=30)
e.grid(row=0, column=1) 

Creates a Button widget (b) that triggers the app() function when pressed. This widget is placed in the second row and second column of the window using the grid() method.

# creating a button using the widget
b = Button(master, text="Show", command=app, bg="seagreen")
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5)  

Starts the Tkinter event loop with the mainloop() method, which keeps the window open and responsive to user input until it is closed.

mainloop()

Overall, this application combines the power of Python, the user-friendly Tkinter framework, and the Winapps library to create an intuitive GUI that allows users to query and view information about their installed Windows apps.

You can watch the video below:

Comments...

banner