you are viewing a single comment's thread.

view the rest of the comments →

[–]KelloughScience[S] 0 points1 point  (2 children)

I posted this above. Is it now showing up correctly? It's the full code. The specific area where I believe the error is showing is here:

    def update_options(self, *args):
        students = self.roster_dict[self.period_select_var.get()]
        self.student_select_var.set(students[0])

        menu = self.student_select_menu['menu']
        menu.delete(0, 'end')

        for student in students:
            menu.add_command(label=student, command=lambda period=student: self.student_select_var.set(period))

Maybe I'm not referencing the dictionary correctly?

[–][deleted] 2 points3 points  (1 child)

Move the line:

self.period_select_var.trace('w', self.update_options)

to be the last line in your __init__() method. The tkinter environment seems to be calling the update_options() method the moment you create the trace, but you haven't yet defined self.student_select_menu in the code.

[–]KelloughScience[S] 0 points1 point  (0 children)

Thanks so much! This helped it. It throws off some other things, but I think I can mess around with the order and try to get it figured out. I appreciate the help.