We start as usual by building the root window (7.01/view.py):
root = Tk()SCREEN_WIDTH = root.winfo_screenwidth()SCREEN_HEIGHT = root.winfo_screenheight()SCREEN_X_CENTER = (SCREEN_WIDTH - WINDOW_WIDTH) / 2SCREEN_Y_CENTER = (SCREEN_HEIGHT - WINDOW_HEIGHT) / 2root.geometry('%dx%d+%d+%d' % (WINDOW_WIDTH, WINDOW_HEIGHT, SCREEN_X_CENTER, SCREEN_Y_CENTER))root.resizable(False, False)PianoTutor(root)root.mainloop()
We also create a new file named constants.py( 7.01), which currently holds the height parameters for the window.
We use two root window methods, root.winfo_screenwidth()and root_winfo_screenheight(), to obtain the screen width and height, respectively. We define two constants, WINDOW_WIDTH and WINDOW_HEIGHT ...