Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pythonclient
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charley.punshon
pythonclient
Commits
2c50ecb5
Commit
2c50ecb5
authored
Apr 27, 2021
by
charley.punshon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update main.py
parent
8405207a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
main.py
main.py
+23
-16
No files found.
main.py
View file @
2c50ecb5
...
...
@@ -9,12 +9,11 @@ width = window.winfo_screenwidth()
height
=
window
.
winfo_screenheight
()
canvasmain
=
Canvas
(
window
,
width
=
f
'{width / 2}'
,
height
=
f
'{height * 4}'
,
bg
=
'#cae8dc'
)
scrollbar
=
Scrollbar
(
window
,
orient
=
"vertical"
,
command
=
canvasmain
.
yview
)
authenticated
=
FALSE
def
login
():
loginr
=
t
.
request
(
'POST'
,
'http://cs2s.yorkdc.net:5002/loggedin'
,
fields
=
{
'username'
:
username
.
get
(),
'password'
:
password
.
get
()})
print
(
loginr
.
status
)
if
loginr
.
status
==
200
:
canvastitle
.
delete
(
"all"
)
canvastitle
.
create_text
(
500
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Dog Breed For You"
)
...
...
@@ -26,22 +25,27 @@ def login():
canvastitle
.
create_window
(
450
,
180
,
anchor
=
NW
,
window
=
homeBtn
)
menu
()
else
:
canvastitle
.
create_text
(
500
,
2
30
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
text
=
"Login unsuccessful try again"
)
canvastitle
.
create_text
(
500
,
2
55
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
text
=
"Login unsuccessful try again"
)
def
logout
():
window
.
destroy
()
def
guestclient
():
canvastitle
.
delete
(
"all"
)
canvastitle
.
create_text
(
500
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Dog Breed For You"
)
homeBtn
=
Button
(
window
,
text
=
"Home"
,
command
=
guestclient
)
homeBtn
.
pack
(
pady
=
20
)
canvastitle
.
create_window
(
450
,
180
,
anchor
=
NW
,
window
=
homeBtn
)
canvasmain
.
delete
(
"all"
)
canvastitle
.
create_text
(
500
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Login"
)
canvastitle
.
create_text
(
400
,
130
,
fill
=
"black"
,
font
=
"Arial 15 bold"
,
text
=
"Username: "
)
username
=
Entry
(
window
)
canvastitle
.
create_window
(
550
,
130
,
window
=
username
)
canvastitle
.
create_text
(
400
,
170
,
fill
=
"black"
,
font
=
"Arial 15 bold"
,
text
=
"Password: "
)
password
=
Entry
(
window
)
canvastitle
.
create_window
(
550
,
170
,
window
=
password
)
loginBtn
=
Button
(
window
,
text
=
"Login"
,
command
=
login
)
loginBtn
.
pack
(
pady
=
10
)
canvastitle
.
create_window
(
450
,
190
,
anchor
=
NW
,
window
=
loginBtn
)
canvasmain
.
create_text
(
1000
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Select an option"
)
# Dog Breed Info Button
dogBreedInfoBtn
=
Button
(
window
,
text
=
"Get Dog Breed Information"
,
width
=
30
,
command
=
getDogs
)
dogBreedInfoBtn
.
pack
(
pady
=
20
)
canvasmain
.
create_window
(
900
,
150
,
anchor
=
NW
,
window
=
dogBreedInfoBtn
)
canvasmain
.
pack
(
fill
=
'both'
,
pady
=
20
)
def
menu
():
...
...
@@ -70,7 +74,6 @@ def getDogs():
t
=
urllib3
.
PoolManager
()
response
=
t
.
request
(
'GET'
,
"http://cs2s.yorkdc.net:5002/dogs"
)
if
response
.
status
==
200
:
scrollbar
.
destroy
()
canvasmain
.
delete
(
"all"
)
canvasmain
.
create_text
(
900
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Dog Breed Information"
)
scrollbar
=
Scrollbar
(
window
,
orient
=
"vertical"
,
command
=
canvasmain
.
yview
)
...
...
@@ -230,5 +233,9 @@ canvastitle.create_window(550, 170, window=password)
loginBtn
=
Button
(
window
,
text
=
"Login"
,
command
=
login
)
loginBtn
.
pack
(
pady
=
10
)
loginBtn_window
=
canvastitle
.
create_window
(
450
,
190
,
anchor
=
NW
,
window
=
loginBtn
)
canvastitle
.
create_window
(
550
,
170
,
window
=
password
)
guestLoginBtn
=
Button
(
window
,
text
=
"Login as Guest"
,
command
=
guestclient
)
guestLoginBtn
.
pack
(
pady
=
10
)
guestLoginBtn_window
=
canvastitle
.
create_window
(
445
,
220
,
anchor
=
NW
,
window
=
guestLoginBtn
)
canvastitle
.
pack
(
pady
=
20
)
window
.
mainloop
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment