# How to open External Programs using Tkinter?

PythonTkinterGUI-Programming

Sometimes, while creating an application, we need to interact with external programs and applications. In order to interact with the system's applications and programs, we have to use os Module in python.

In this article, we will see how we can interact with external programs and open files using the OS module in Python.

First, we will define a function that will open the chosen file using the filedialog library in Python. Then, we will print the path and open the file using the os module.

## Example

# Import the required Libraries
from tkinter import *
from tkinter import filedialog
import os

#Create an instance of tkinter frame
win= Tk()

#Set the geometry for the window or frame
win.geometry("600x400")

#Define a function to open the application

def app():
text.config(text= file)
#Open the program
os.system('"%s"' %file)

#Create a button
Button(win, text='Click to Open a Program',font=('Poppins bold', 10),

#Create a Label after button event
text= Label(win, text= "", font= ('Poppins bold', 10))
win.mainloop()