- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a directly-executable cross-platform GUI app using Python(Tkinter)?
Python is a programming language which can be used to create cross-platform applications that are supported in various operating systems such as Microsoft Windows, Mac OS, and Linux.
To create a GUI-based application, we can use the Tkinter library. However, Python provides different modules and extensions which convert a program into an executable application.
For Windows executables - PyInstaller, py2exe
For Linux executables - Freeze
For Max executables - py2app
For this example, we will first install the PyInstaller module using pip in our Windows operating system. The module can be installed by using the command,
pip install pyInstaller
Using this module, we will convert our application into an executable file.
In this application, we will ask the user to select Particular days from the list.
# Import the required libraries from tkinter import * # Create an instance of tkinter frame win = Tk() # Set the size of the tkinter window win.geometry("700x350") # Add a Label Label(win, text="Select a Day from the Menu", font=('Aerial 13')).pack(pady=10) # Create a Variable to store the selection var = StringVar() # Create an OptionMenu Widget and add choices to it option = OptionMenu(win, var, "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") option.config(bg="gray81", fg="white") option['menu'].config(bg="green3") option.pack(padx=20, pady=30) win.mainloop()
Steps to Create Executable File in Python
Open the command prompt in the directory and write the command for creating an executable file,
It will create a folder that contains an executable file app.exe. Open the file to run the application.
- How to create an impressive GUI in Python using Tkinter?
- Introduction to Kivy; A Cross-platform Python Framework
- How do I create an automatically updating GUI using Tkinter in Python?
- Is Flutter a stable platform to develop cross platform application?
- How to build a simple GUI calculator using tkinter in Python
- How do I create an automatically updating GUI using Tkinter?
- Simple GUI calculator using Tkinter in Python
- Ratio Calculator GUI using Tkinter
- How to compile a Python 3 app to an .exe using Tkinter?
- Creating a tkinter GUI layout using frames and grid
- How do you create a Tkinter GUI stop button to break an infinite loop?
- How to directly modify a specific item in a TKinter listbox?
- Python to create a digital clock using Tkinter
- How to create a timer using tkinter?
- How to create a borderless fullscreen application using Python-3 Tkinter?