def main(): import sys args = sys.argv[1:] global WINDOW_WIDTH global WINDOW_HEIGHT if len(args) == 2: WINDOW_WIDTH = int(args[0]) WINDOW_HEIGHT = int(args[1]) else: WINDOW_WIDTH = 1000 WINDOW_HEIGHT = 600 # Load data name_data = babynames.read_files(FILENAMES) # Make window top = tkinter.Tk() top.wm_title('Baby Names Solution') canvas = gui.make_gui(top, WINDOW_WIDTH, WINDOW_HEIGHT, name_data, draw_names, babynames.search_names) # draw_fixed once at startup so we have the lines # even before the user types anything. draw_fixed_lines(canvas) # This needs to be called just once top.mainloop()
def main(): # Load data name_data = babynames.read_files(FILENAMES) # Create the window and the canvas top = tkinter.Tk() top.wm_title('Baby Names') canvas = gui.make_gui(top, CANVAS_WIDTH, CANVAS_HEIGHT, name_data, draw_names, babynames.search_names) # Call draw_fixed_lines() once at startup so we have the lines # even before the user types anything. draw_fixed_lines(canvas) # This line starts the graphical loop that is responsible for # processing user interactions and plotting data top.mainloop()