Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lab Advanced Software Development
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bui2.Huan@live.uwe.ac.uk
Lab Advanced Software Development
Commits
8e41f43c
Commit
8e41f43c
authored
2 weeks ago
by
Bui2.Huan@live.uwe.ac.uk
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
5361c24b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Week 8/activity6.py
+64
-0
64 additions, 0 deletions
Week 8/activity6.py
with
64 additions
and
0 deletions
Week 8/activity6.py
0 → 100644
+
64
−
0
View file @
8e41f43c
from
tkinter
import
Tk
,
ttk
# Create main window
wndw
=
Tk
()
wndw
.
title
(
"
Coursework GUI
"
)
wndw
.
geometry
(
"
500x500
"
)
# Create a Notebook (tabbed interface)
notebook
=
ttk
.
Notebook
(
wndw
)
notebook
.
pack
(
expand
=
True
,
fill
=
'
both
'
)
# Home tab
home_frame
=
ttk
.
Frame
(
notebook
)
ttk
.
Label
(
home_frame
,
text
=
"
Welcome to the Coursework GUI!
"
,
font
=
(
"
Helvetica
"
,
14
)).
pack
(
pady
=
20
)
notebook
.
add
(
home_frame
,
text
=
"
Home
"
)
# Registration tab
registration_frame
=
ttk
.
Frame
(
notebook
)
ttk
.
Label
(
registration_frame
,
text
=
"
User Registration
"
,
font
=
(
"
Helvetica
"
,
14
)).
pack
(
pady
=
20
)
notebook
.
add
(
registration_frame
,
text
=
"
Registration
"
)
# About tab
about_frame
=
ttk
.
Frame
(
notebook
)
ttk
.
Label
(
about_frame
,
text
=
"
About this application
"
,
font
=
(
"
Helvetica
"
,
14
)).
pack
(
pady
=
20
)
notebook
.
add
(
about_frame
,
text
=
"
About
"
)
# Registration form elements
ttk
.
Label
(
registration_frame
,
text
=
"
First Name:
"
).
pack
(
pady
=
5
)
first_name_entry
=
ttk
.
Entry
(
registration_frame
,
width
=
30
)
first_name_entry
.
pack
(
pady
=
5
)
ttk
.
Label
(
registration_frame
,
text
=
"
Surname:
"
).
pack
(
pady
=
5
)
surname_entry
=
ttk
.
Entry
(
registration_frame
,
width
=
30
)
surname_entry
.
pack
(
pady
=
5
)
ttk
.
Label
(
registration_frame
,
text
=
"
Gender:
"
).
pack
(
pady
=
5
)
gender_var
=
ttk
.
Combobox
(
registration_frame
,
values
=
[
"
Male
"
,
"
Female
"
,
"
Other
"
],
width
=
27
)
gender_var
.
pack
(
pady
=
5
)
gender_var
.
set
(
"
Select
"
)
ttk
.
Label
(
registration_frame
,
text
=
"
Date of Birth (DD/MM/YYYY):
"
).
pack
(
pady
=
5
)
dob_entry
=
ttk
.
Entry
(
registration_frame
,
width
=
30
)
dob_entry
.
pack
(
pady
=
5
)
# Register button
def
register_user
():
first_name
=
first_name_entry
.
get
()
surname
=
surname_entry
.
get
()
gender
=
gender_var
.
get
()
dob
=
dob_entry
.
get
()
if
not
first_name
or
not
surname
or
gender
==
"
Select
"
or
not
dob
:
ttk
.
Label
(
registration_frame
,
text
=
"
Please fill out all fields!
"
,
foreground
=
'
red
'
).
pack
(
pady
=
5
)
return
ttk
.
Label
(
registration_frame
,
text
=
f
"
Registered:
{
first_name
}
{
surname
}
"
).
pack
(
pady
=
5
)
ttk
.
Button
(
registration_frame
,
text
=
"
Register
"
,
command
=
register_user
).
pack
(
pady
=
10
)
# About content
ttk
.
Label
(
about_frame
,
text
=
"
This is a sample coursework GUI.
\n
Built using Python Tkinter.
"
,
justify
=
'
center
'
).
pack
(
pady
=
20
)
# Start the Tkinter event loop
wndw
.
mainloop
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment