import
tkinter as tk
import
tkinter.font as font
import
csv as csv
import
numpy as np
from
reporting
import
*
def
center_window_on_screen():
x_cord
=
int
((screen_width
/
2
)
-
(width
/
2
))
y_cord
=
int
((screen_height
/
2
)
-
(height
/
2
))
root.geometry(
f
"{width}x{height}+{x_cord}+{y_cord}"
)
def
change_main_to_filem():
file_maint_frame.pack(fill
=
'both'
, expand
=
1
)
main_frame.forget()
def
change_filem_to_main():
main_frame.pack(fill
=
'both'
, expand
=
1
)
file_maint_frame.forget()
def
change_main_to_schedm():
sched_maint_frame.pack(fill
=
'both'
, expand
=
1
)
main_frame.forget()
def
change_schedm_to_main():
main_frame.pack(fill
=
'both'
, expand
=
1
)
sched_maint_frame.forget()
def
change_main_to_report():
reporting_frame.pack(fill
=
'both'
, expand
=
1
)
main_frame.forget()
def
change_report_to_main():
main_frame.pack(fill
=
'both'
, expand
=
1
)
reporting_frame.forget()
def
change_filem_to_physm():
phys_maint_frame.pack(fill
=
'both'
, expand
=
1
)
file_maint_frame.forget()
def
change_filem_to_charm():
char_maint_frame.pack(fill
=
'both'
, expand
=
1
)
file_maint_frame.forget()
def
change_filem_to_calm():
cal_maint_frame.pack(fill
=
'both'
, expand
=
1
)
file_maint_frame.forget()
def
change_physm_to_filem():
file_maint_frame.pack(fill
=
'both'
, expand
=
1
)
phys_maint_frame.forget()
def
change_charm_to_filem():
file_maint_frame.pack(fill
=
'both'
, expand
=
1
)
char_maint_frame.forget()
def
change_calm_to_filem():
file_maint_frame.pack(fill
=
'both'
, expand
=
1
)
cal_maint_frame.forget()
def
change_report_to_main_avail_rpt():
main_avail_frame.pack(fill
=
'both'
, expand
=
1
)
reporting_frame.forget()
def
change_main_avail_rpt_to_report():
reporting_frame.pack(fill
=
'both'
, expand
=
1
)
main_avail_frame.forget()
def
change_report_to_sx_avail_rpt():
sx_avail_frame.pack(fill
=
'both'
, expand
=
1
)
reporting_frame.forget()
def
change_sx_avail_rpt_to_report():
reporting_frame.pack(fill
=
'both'
, expand
=
1
)
sx_avail_frame.forget()
def
change_report_to_main_sched_rpt():
main_sched_rpt_frame.pack(fill
=
'both'
, expand
=
1
)
reporting_frame.forget()
def
change_main_sched_rpt_to_report():
reporting_frame.pack(fill
=
'both'
, expand
=
1
)
main_sched_rpt_frame.forget()
def
change_report_to_sx_sched_rpt():
sx_sched_rpt_frame.pack(fill
=
'both'
, expand
=
1
)
reporting_frame.forget()
def
change_sx_sched_rpt_to_report():
reporting_frame.pack(fill
=
'both'
, expand
=
1
)
sx_sched_rpt_frame.forget()
def
save_rtn():
print
(
"Save and Exit"
)
file_save()
exit()
def
exit_rtn():
print
(
"Quit"
)
exit()
def
file_save():
temp_file
=
open
(
"Physician.sch"
,
'w'
)
rows
=
len
(df_phys)
cols
=
len
(df_phys[
0
])
print
(
"Phys : "
, rows, cols)
for
i
in
range
(rows):
for
j
in
range
(cols):
temp_file.write(df_phys[i][j]
+
"\n"
)
temp_file.close()
temp_file
=
open
(
"Calendar.sch"
,
'w'
)
rows
=
len
(df_cal)
cols
=
len
(df_cal[
0
])
print
(
"Cal : "
, rows, cols)
for
i
in
range
(rows):
for
j
in
range
(cols):
temp_file.write(df_cal[i][j]
+
"\n"
)
temp_file.close()
temp_file
=
open
(
"Schedule.sch"
,
'w'
)
rows
=
len
(df_sched)
cols
=
len
(df_sched[
0
])
print
(
"Sched: "
, rows, cols)
for
i
in
range
(rows):
for
j
in
range
(cols):
temp_file.write(df_sched[i][j]
+
"\n"
)
temp_file.close()
root
=
tk.Tk()
root.title(
"The Dreaded Call Schedule v0.1a"
)
root.configure(bg
=
'lightyellow'
)
width, height
=
800
,
600
screen_width
=
root.winfo_screenwidth()
screen_height
=
root.winfo_screenheight()
center_window_on_screen()
main_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
file_maint_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
phys_maint_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
char_maint_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
cal_maint_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
sched_maint_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
reporting_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
main_avail_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
sx_avail_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
main_sched_rpt_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
sx_sched_rpt_frame
=
tk.Canvas(root, width
=
800
, height
=
600
)
font_large
=
font.Font(family
=
'Candara'
,
size
=
24
,
weight
=
'bold'
)
font_small
=
font.Font(family
=
'Candara'
,
size
=
12
)
img_logo_main
=
tk.PhotoImage(
file
=
'logo.png'
)
lbl_logo_main_frame
=
tk.Label(main_frame,
image
=
img_logo_main)
lbl_logo_main_frame.place(x
=
680
, y
=
8
)
lbl_heading_main_frame
=
tk.Label(main_frame,
text
=
'Welcome to the Call Schedule'
,
font
=
font_large)
lbl_heading_main_frame.place(x
=
200
, y
=
100
)
btn_change_to_work
=
tk.Button(main_frame,
text
=
'File Maintenance'
,
font
=
font_small,
command
=
change_main_to_filem)
btn_change_to_work.place(x
=
250
, y
=
200
)
btn_change_to_sched
=
tk.Button(main_frame,
text
=
'Schedule Work'
,
font
=
font_small,
command
=
change_main_to_schedm)
btn_change_to_sched.place(x
=
400
, y
=
200
)
btn_change_to_report
=
tk.Button(main_frame,
text
=
'Produce Reports'
,
font
=
font_small,
command
=
change_main_to_report)
btn_change_to_report.place(x
=
250
, y
=
250
)
btn_change_to_stuff
=
tk.Button(main_frame,
text
=
'?? future ??'
,
font
=
font_small,
command
=
change_main_to_schedm)
btn_change_to_stuff.place(x
=
400
, y
=
250
)
btn_save_work
=
tk.Button(main_frame,
font
=
font_small,
text
=
'Save and Exit'
,
command
=
save_rtn)
btn_save_work.place(x
=
250
, y
=
350
)
btn_exit_work
=
tk.Button(main_frame,
font
=
font_small,
text
=
'Quit - no Save'
,
command
=
exit_rtn)
btn_exit_work.place(x
=
400
, y
=
350
)
main_frame.create_line(
700
,
200
,
750
,
400
, width
=
3
, fill
=
'orange'
)
img_logo_filem
=
tk.PhotoImage(
file
=
'logo.png'
)
lbl_logo_file_maint
=
tk.Label(file_maint_frame,
image
=
img_logo_filem)
lbl_logo_file_maint.place(x
=
680
, y
=
8
)
lbl_heading_file_maint
=
tk.Label(file_maint_frame,
text
=
'File Maintenance'
,
font
=
font_large)
lbl_heading_file_maint.place(x
=
150
, y
=
100
)
btn_change_to_phys_maint
=
tk.Button(file_maint_frame,
font
=
font_small,
text
=
'Physician Maintenance'
,
command
=
change_filem_to_physm)
btn_change_to_phys_maint.place(x
=
150
, y
=
200
)
btn_change_to_char_maint
=
tk.Button(file_maint_frame,
font
=
font_small,
text
=
'Character Maintenance'
,
command
=
change_filem_to_charm)
btn_change_to_char_maint.place(x
=
350
, y
=
200
)
btn_change_to_cal_maint
=
tk.Button(file_maint_frame,
font
=
font_small,
text
=
'Calender Maintenance'
,
command
=
change_filem_to_calm)
btn_change_to_cal_maint.place(x
=
150
, y
=
250
)
btn_change_to_main
=
tk.Button(file_maint_frame,
font
=
font_small,
text
=
'Exit'
,
command
=
change_filem_to_main)
btn_change_to_main.place(x
=
150
, y
=
300
)
file_maint_frame.create_line(
750
,
300
,
700
,
400
, width
=
3
, fill
=
'purple'
)
setup_reporting_frame()
temp_file
=
open
(
"physician.sch"
,
'r'
)
count
=
0
for
x
in
temp_file:
count
=
count
+
1
temp_file.close()
rows
=
int
(count
/
11
)
df_phys
=
[]
temp_list
=
[]
temp_file
=
open
(
"physician.sch"
,
'r'
)
for
i
in
range
(rows):
for
j
in
range
(
11
):
x
=
temp_file.readline()
temp_list
=
temp_list
+
x.splitlines()
print
(temp_list)
df_phys.append(temp_list)
temp_list
=
[]
print
(df_phys)
temp_file.close()
temp_file
=
open
(
"calendar.sch"
,
'r'
)
count
=
0
for
x
in
temp_file:
count
=
count
+
1
temp_file.close()
rows
=
int
(count
/
3
)
df_cal
=
[]
temp_list
=
[]
temp_file
=
open
(
"calendar.sch"
,
'r'
)
for
i
in
range
(rows):
for
j
in
range
(
3
):
x
=
temp_file.readline()
temp_list
=
temp_list
+
x.splitlines()
print
(temp_list)
df_cal.append(temp_list)
temp_list
=
[]
print
(df_cal)
temp_file.close()
temp_file
=
open
(
"schedule.sch"
,
'r'
)
count
=
0
for
x
in
temp_file:
count
=
count
+
1
temp_file.close()
rows
=
int
(count
/
15
)
df_sched
=
[]
temp_list
=
[]
temp_file
=
open
(
"schedule.sch"
,
'r'
)
for
i
in
range
(rows):
for
j
in
range
(
15
):
x
=
temp_file.readline()
temp_list
=
temp_list
+
x.splitlines()
print
(temp_list)
df_sched.append(temp_list)
temp_list
=
[]
print
(df_sched)
temp_file.close()
img_logo_phys
=
tk.PhotoImage(
file
=
'info.png'
)
lbl_logo_phys_maint
=
tk.Label(phys_maint_frame,
image
=
img_logo_phys)
lbl_logo_phys_maint.place(x
=
680
, y
=
8
)
lbl_heading_phys_maint
=
tk.Label(phys_maint_frame,
text
=
'Physician Maintenance'
,
font
=
font_large)
lbl_heading_phys_maint.place(x
=
150
, y
=
100
)
btn_change_to_filem
=
tk.Button(phys_maint_frame,
font
=
font_small,
text
=
'Exit'
,
command
=
change_physm_to_filem)
btn_change_to_filem.place(x
=
150
, y
=
300
)
phys_maint_frame.create_line(
750
,
300
,
700
,
400
, width
=
3
, fill
=
'green'
)
img_logo_cal
=
tk.PhotoImage(
file
=
'info.png'
)
lbl_logo_cal_maint
=
tk.Label(cal_maint_frame,
image
=
img_logo_cal)
lbl_logo_cal_maint.place(x
=
680
, y
=
8
)
lbl_heading_cal_maint
=
tk.Label(cal_maint_frame,
text
=
'Calendar Maintenance'
,
font
=
font_large)
lbl_heading_cal_maint.place(x
=
150
, y
=
100
)
btn_change_to_filem
=
tk.Button(cal_maint_frame,
font
=
font_small,
text
=
'Exit'
,
command
=
change_calm_to_filem)
btn_change_to_filem.place(x
=
150
, y
=
300
)
cal_maint_frame.create_line(
750
,
300
,
700
,
400
, width
=
3
, fill
=
'gold'
)
img_logo_char
=
tk.PhotoImage(
file
=
'info.png'
)
lbl_logo_char_maint
=
tk.Label(sched_maint_frame,
image
=
img_logo_char)
lbl_logo_char_maint.place(x
=
680
, y
=
8
)
lbl_heading_char_maint
=
tk.Label(sched_maint_frame,
text
=
'Main Schedule Maintenance'
,
font
=
font_large)
lbl_heading_char_maint.place(x
=
150
, y
=
100
)
btn_change_to_filem
=
tk.Button(sched_maint_frame,
font
=
font_small,
text
=
'Exit'
,
command
=
change_schedm_to_main)
btn_change_to_filem.place(x
=
150
, y
=
300
)
char_maint_frame.create_line(
750
,
300
,
700
,
400
, width
=
3
, fill
=
'light green'
)
main_frame.pack(fill
=
'both'
, expand
=
1
)
root.mainloop()