diff --git a/schedule.py b/schedule.py index 51dc8a6..ea458e8 100644 --- a/schedule.py +++ b/schedule.py @@ -74,15 +74,18 @@ locations, teachers, days = parse_courses('cache/sample_semester.json') #print(json.dumps(teachers,indent=2)) #print(json.dumps(days,indent=2)) -for L,C in locations.items(): - print(f"\n{L}") - for crs in C: - print(" " + course_to_string(crs)) +dump = 0 + +if dump: + for L,C in locations.items(): + print(f"\n{L}") + for crs in C: + print(" " + course_to_string(crs)) -for T,C in teachers.items(): - print(f"\n{T}") - for crs in C: - print(" " + course_to_string(crs)) + for T,C in teachers.items(): + print(f"\n{T}") + for crs in C: + print(" " + course_to_string(crs)) # EXAMPLES # @@ -100,4 +103,23 @@ for course in locations[room]: teacher = 'Kimberly J Smith' print(f"\nWeekly schedule for {teacher}:") for course in teachers[teacher]: - print(" " + course_to_string(course)) \ No newline at end of file + print(" " + course_to_string(course)) + +import sys +import os + +columns, rows = os.get_terminal_size() +print(f"Terminal size: {columns} columns x {rows} rows") + + +def write_at(row, col, text): + sys.stdout.write(f"\033[{row};{col}H{text}") + sys.stdout.flush() + +# +lines = [1,2,3,4,5] +for L in lines: + myline = rows - L + write_at(myline, 1, f"This is line {myline}") + +write_at(rows,0,'')