Hi there! today I just wanted to discuss the python desktop ui. Actually, I have been researching the topic for the last few months then I just got a simple method to do so.
Python is a programming language with many features and libraries that can be used to create desktop GUI applications. One such library is Tkinter, which is a standard GUI library for Python. In this article, we will see how to create a Python desktop GUI application using Tkinter.
We will first see how to create a simple popup window using Tkinter. Then, we will see how to add various widgets to the window. Finally, we will see how to connect the application to a database.
Creating a Python desktop GUI application can be a fun and rewarding experience. With Tkinter, you can easily create a Python desktop GUI application that looks great and is also easy to use.
Python is a very strong programing language and can be used for various other purposes of example: Extracting Images from a Video.
Please be with this blog till the end. Please follow the steps for python desktop ui:
- Create a directory and then install python v3,
pip
,pipenv
,Tkinter
,pyinstaller
,tkmessagebox
. - Create a file i.e. desktop_main.py
# Create python file inside your project folder C:\Users\COM\Desktop\pydesktop> touch desktop_main.py
Inside the dektop_main.py
from tkinter import * def populate_list(): print('Populate') def add_item(): print('Add') # dektop window create app = Tk() name_text = StringVar() name_label = Label(app, text='Full Name : ', font=('bold', 14), pady=20) name_label.grid(row=0, column=0, sticky=W) name_entry = Entry(app, textvariable=name_text) name_entry.grid(row=0,column=1) #name list box name_list = Listbox(app, height=8, width=50) name_list.grid(row=3, column=0, columnspan=3, rowspan=6, pady=20, padx=20) #scrillbar scrollbar = Scrollbar(app) scrollbar.grid(row=3, column=3) name_list.configure(yscrollcommand=scrollbar.set) scrollbar.configure(command=name_list.yview) #button add_button = Button(app, text='Add Name', width=12, command=add_item) add_button.grid(row=2, column=0, pady=20) #window title app.title('Main Window') #window dimensions app.geometry('850x450') populate_list() #start app app.mainloop()
Will explain the above peace of code in the next blog.
Now its time to run your first desktop GUI app
# Execute your desktop_main.py C:\Users\COM\Desktop\pydesktop>python dektop_main.py
Is that simple? just a few steps and you are good to go.
OK, thanks.. will explain in detail in the next article about Tkinter and DB [store, retrieve, delete] integration on the same app.
You can see some other sites for similar topics.