Saturday, January 18, 2020

IslandT: Create the input text box with tkinter

In the previous post, I have written a python program to create the database, earning table as well as input the first row of data into the earning table. In this chapter, I will create a simple UI to accept the user’s input so we do not need to hardcoded the values into the SQL query. I will leave the SQL commit code to the next chapter, we will only create a simple input’s UI in this chapter first.

A description box and the earning box of the Earning Input user interface

As you can see I will create the above simple UI with tkinter which can then be further upgraded in the future to include more stuff.

import tkinter as tk
from tkinter import ttk

win = tk.Tk()

win.title("Earning Input")

def submit():
    pass

#create label frame for ui
earn= ttk.Labelframe(win, text = "Daily Earning Input")
earn.grid(column=0, row=0, padx=4, pady=4)
# create label for description
dLabel = ttk.Label(earn, text="Description:").grid(column=0, row=0)
# create text box for description
description = tk.StringVar()
descriptionEntry = ttk.Entry(earn, width=13, textvariable=description)
descriptionEntry.grid(column=1, row=0)

# create label for earning
eLabel = ttk.Label(earn, text="Earning:").grid(column=2, row=0)
# create text box for earning
earning = tk.StringVar()
earningEntry = ttk.Entry(earn, width=13, textvariable=earning)
earningEntry.grid(column=3, row=0)
# create the action button
action = ttk.Button(earn, text="submit", command=submit)
action.grid(column=5, row=0)

win.resizable(0,0)

win.mainloop()

I will write a program to submit the above data to the earning table in the next chapter.

This website will update constantly because I have decided to make writing articles one of my income streams, so do subscribe to the RSS feed of this site, and also, do read the other topic besides the python related one if you love another topic as well!

This is just for your info, I have found out another free to use universal database browser which you can download and play around through this link! If you are a software developer and would like me to include one of your free product in my post that is related to your type of product, do leave your comment under that particular post, I would really like to help a developer likes you to promote your software, so drop me a suggestion!



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...