Module 7: Application Design Principles: Learning Outcomes
Module 7: Application Design Principles: Learning Outcomes
Learning Outcomes:
At the end of the lesson, the students are able to:
Understand the Application Design Principles in Window-Based Applications.
Implement Menu Bar, Toolbar and Pop-up Menu using Python.
Display database records using TKinter Treeview.
Create a User Log-In authentication process.
Introduction
Your application should present its components to the user in a logical and task-organized manner. Menus
should follow a common organization and naming convention to enable users to use the same rules and
practices across the desktop. The following sections outline the Common Desktop Environment application
design and menu structure requirements.
View Menu
If your application provides a View menu, it only contains functions that affect the way the current data is
presented. It does not contain any option that alters the data itself.
Options Menu
If your application has global settings that control the way the application behaves, it provides an Options
menu from which these can be set.
Pop-up Menus
Pop-up menus provide access to frequently used functions and should be used pervasively throughout the
Common Desktop Environment desktop environment. A pop-up menu may contain a collection of options that
appear in different menus available from the menu bar. For example, it may contain items from both the File
and Edit menus.
Your application should provide a pop-up menu for any element that is selectable within its
data pane.
If your application provides functions that apply to a data pane and not any specific element
therein, then a pop-up menu is provided that contains the frequently used data pane
functions and is accessible by pressing BMenu when the mouse pointer is over the
background of the pane or a nonselectable element within the pane.
Tool Bars
Tool bars are a method used to provide quick access to things that are already user-accessible in an
application by other methods. For example, an application can provide access to frequently used features from
its menus through its tool bar. Some common usages of tool bars are navigation, changing data views, accessing
frequently used tools or editors, simplifying the number of steps to complete a common operation, and
providing a fast path to frequently used menu items.
Design Issues for Tool Bars
Would the usability of the application be improved by placing these items on the tool bar?
o Tool bars should only be used when they improve or enhance user access to
common operations, such as in an application with several large menus.
What kinds of operations are being placed on a tool bar? How are they grouped?
o Tool bars should present a natural organization of actions. Grouping items that are
dissimilar can confuse users because they do not expect to find the item they are
looking for in that context.
Is the tool bar too crowded?
o Placing too many items in the tool bar can cause the user to have to search for the
item they are looking for, rather then being able to quickly find it and use it. Keep
the number of buttons to a minimum so that you don't increase the difficulty of your
application when using a tool bar.
Are the icons clearly representative of their associated action?
o Cryptic icons add to user confusion. Keep the pixmaps as simple as possible.
Remember that all graphics must be international in scope. When designing a
graphic to represent a command, such as Save, remember that the icon has to
represent a verb, as opposed to a noun like most other icons. This can make the icon
more confusing to users.
Window Titles
The title of your primary window (the main window your application displays to the user) should
be the name of your application.
Use initial capital letters for each word in the title (in languages that support capitalization).
Work-in-Progress Feedback
If any command chosen by the user is expected to take longer than 2 seconds to complete, but less than
10 seconds, your application displays the standard busy pointer as feedback that the command is
executing.
The user must receive assurance that your application has "heard" the request and is working on it. If
the results of the request cannot be displayed immediately, some feedback must be provided. The busy
cursor should be displayed within 0.5 seconds of execution of the command.
General Application Design Rules
There is always exactly one control within any window of your application that has the input focus if
the window in which it resides has the input focus.
If any window within your application has focus, some control within that window must have focus.
The user should not have to explicitly set focus to a control within the window.
Application Installation
Applications should be installed to folders in the Application Manager not directly to the Front Panel or
subpanels. For consistency, only Common Desktop Environment desktop components will install to these
locations. Users may choose to rearrange their Front Panel, but applications should not do this without user
consent.
B. For Pydroid3
i. Tap Pydroid3 Settings >> Tap Terminal and install the following
a. pip install pillow
b. pip install pillow-PIL
c. pip install mysql-connector-python
*For Pyroid3 Users: Create an images folder in your project directory and copy the downloaded
images.
4. Right Click package name MODULE6_FILES_ICSC106_INITIALS and select New >> Python File >>
type name frmMain_initials.
5. IMPORT TKINTER LIBRARY AND MYSQL. Type the following codes in frmMain_initials.py
6. CREATE FUNCTION FOR OPENING THE WINDOWS AND POPUP MENU. The Python Files must be
on the same project.
7. CREATE THE MAIN WINDOW - Provide the following codes after the previous section in
frmMain_initials.py
8. CREATE THE MAIN MENU AND SUB MENUS - Provide the following codes after the previous section
in frmMain_initials.py
9. CREATE THE TOOLBAR AND BUTTONS - Provide the following codes after the previous section in
frmMain_initials.py
#Create Toolbar
toolbar = Frame(root, bd=1, relief=RAISED)
toolbar.pack(side=TOP, fill=X)
10. CREATE THE POPUP MENU AND MENU OPTIONS - Provide the following codes after the previous
section in frmMain_initials.py
11. APPLY ROOT CONFIG AND LOOPING - Provide the following codes after the previous section in
frmMain_initials.py
root.config(menu=menubar)
root.mainloop()
12. RUN FRMMAIN_INITIALS - The output should look like the image below:
13. Right Click package name MODULE6_FILES_ICSC106_INITIALS and select New >> Python File >>
type name frmUserTable_initials.
14. IMPORT TKINTER LIBRARY AND MYSQL. Type the following codes in frmUserTable_initials.py
15. SETUP THE DATABASE CONNECTION STRING. Provide the following codes after the previous
section in frmUserTable_initials.py
def connectDB():
try:
#SETUP MYSQL CONNECTION STRING
global mySQL
mySQL = connectSQL.connect(
host = "localhost",
user = "root",
passwd = "123456", #For mobile developers using AWebserver use root as password
charset='utf8',
database = "db_bsit_justice_jcb"
)
global myCursor
myCursor = mySQL.cursor()
except ValueError:
pass
16. CREATE THE MAIN WINDOW - Provide the following codes after the previous section in
frmUserTable_initials.py
17. SET THE MAIN FRAME - Provide the following codes after the previous section in
frmUserTable_initials.py
18. SET THE TREEVIEW WIDGET - Provide the following codes after the previous section in
frmUserTable_initials.py
# Defining heading
trv['show'] = 'headings'
19. SET THE QUERY AND POPULATE TREEVIEW WIDGET - Provide the following codes after the
previous section in frmUserTable_initials.py
20. APPLY ROOT CONFIG AND LOOPING - Provide the following codes after the previous section in
frmMain_initials.py
21. RUN FRMUSERTABLE_INITIALS - The output should look like the image below:
22. Right Click package name MODULE6_FILES_ICSC106_INITIALS and select New >> Python File >>
type name frmLogIn_initials.
23. IMPORT TKINTER LIBRARY AND MYSQL. Type the following codes in frmLogIn_initials.py
24. SETUP THE DATABASE CONNECTION STRING. Provide the following codes after the previous
section in frmUserTable_initials.py
def connectDB():
try:
#SETUP MYSQL CONNECTION STRING
global mySQL
mySQL = connectSQL.connect(
host = "localhost",
user = "root",
passwd = "123456", #For mobile developers using AWebserver use root as password
charset='utf8',
database = "db_bsit_justice_jcb"
)
global myCursor
myCursor = mySQL.cursor()
except ValueError:
pass
25. CREATE THE FUNCTION FOR USER LOGIN AND BURAHIN - Provide the following codes after the
previous section in frmLogIn_initials.py
def userLogin():
try:
if (len(strID.get()) == 0):
messagebox.showinfo(title="Data Validation", message="Please Enter User ID!")
txtID.focus()
elif (len(strPassword.get()) == 0):
messagebox.showinfo(title="Data Validation", message="Please Enter User Password!")
txtID.focus()
else:
connectDB()
strSearch = """SELECT * FROM tbluser WHERE User_ID='%s' AND Password='%s'""" %
(strID.get(),strPassword.get())
myCursor.execute(strSearch)
records = myCursor.fetchall()
def burahin():
try:
strID.set("")
strPassword.set("")
txtID.focus()
except ValueError:
pass
26. CREATE THE MAIN WINDOW - Provide the following codes after the previous section in
frmLogIn_initials.py
27. SET THE MAIN FRAME - Provide the following codes after the previous section in
frmLogIn_initials.py
28. DECLARE THE STRING VARIABLES USER LOG-IN - Provide the following codes after the previous
section in frmLogIn_initials.py
29. SET THE WIDGETS FOR USER LOG-IN - Provide the following codes after the previous section in
frmLogIn_initials.py
30. SET THE BUTTONS FOR LOG-IN AND CANCEL - Provide the following codes after the previous
section in frmLogIn_initials.py
31. APPLY ROOT CONFIG AND LOOPING - Provide the following codes after the previous section in
frmLogIn_initials.py
32. RUN FRMLOGIN_INITIALS - The output should look like the image below:
33. Right click frmLogin >> Select Run File >> Perform the following:
a. Log-in User
b. Test Menu Bar Items
c. Test Toolbar Button
d. Test Right Click Main Menu
Module Recap
Your application should present its components to the user in a logical and task-organized manner.
A main window contains a client area and, optionally, a menu bar, a command area, a message area,
and scroll bars.
A menu bar organizes the most common features of an application. It contains a list of menu topics in
buttons; each button is associated with a distinct pull-down menu containing commands that are
grouped by common functionality.
Your application should use the following standard menus when possible to enable the user to easily
locate desired functionality.
If your application provides a View menu, it only contains functions that affect the way the current
data is presented. It does not contain any option that alters the data itself.
Pop-up menus provide access to frequently used functions and should be used pervasively throughout
the Common Desktop Environment desktop environment.
Tool bars are a method used to provide quick access to things that are already user-accessible in an
application by other methods.
Module Assessment
Online assessment will be announced via the learning management system’s calendar.
References
1. Oracle Home Page. . Common Desktop Environment: Style Guide and Certification Checklist. Retrieved
on October 14, 2020 from https://docs.oracle.com/cd/E19455-01/806-2915/6jc3nftni/index.html