示例#1
0
def populate_list6(self, period):
    self.group6_L.clear()
    roster = load_roster(period)
    x = ClassPeriod(roster)
    y = x.groups(6)
    for i in range(len(y[5])):
        self.group6_L.insertItem(i, y[5][i])
def populate_lists(self,period,wanted_groups,widget_list,rand=False):
    for widget in widget_list:
        widget.clear()
    x = ClassPeriod()
    x.set_period(period)
    x.set_roster()
    if rand:
        x.randomize()
    y = x.groups(wanted_groups)
    for i in range(len(widget_list)):
        for j in range(len(y[i])):
            widget_list[i].insertItem(j,y[i][j])
from roster_ops import add_roster, load_roster, edit_roster
from ClassPeriod import ClassPeriod

print('Hello, this is Random Group Creator!\nType "exit" at any time to quit.')

while True:
    choice = input(
        'Do you want to add a roster, load a roster, edit a roster, shuffle a roster, or create groups? '
    )
    choice = choice.lower()
    if choice == 'exit':
        break
    elif choice == 'add':
        add_roster()
    elif choice == 'load':
        print(load_roster())
    elif choice == 'edit':
        edit_roster()
    elif choice == 'shuffle':
        roster = load_roster()
        x = ClassPeriod(roster)
        x.show_roster()
        x.randomize()
    elif choice == 'groups':
        roster = load_roster('second')
        x = ClassPeriod(roster)
        n = input('How many groups? ')
        x.display_groups(int(n))

    else:
        print('Sorry, that answer didn\'t make sense to me.')