Sound like he trying to make Sudoku. 9 rows and 9 columns. Split into 3x3 grid.
1. I don't see enough code to suggest a fix.
2. Don't know GUI you are using? tkinter, pygame, wxpython, pyQt.
3. You need to learn to use containers. List or Dicts instead of making variables n1 to n9.
example. Your code simplified.
1. I don't see enough code to suggest a fix.
2. Don't know GUI you are using? tkinter, pygame, wxpython, pyQt.
3. You need to learn to use containers. List or Dicts instead of making variables n1 to n9.
example. Your code simplified.
def Choose(self): for b in self.nb: possible = [] for n in range(10): possible.append(True) if b.value == 0: for i in self.nb: if i.r == b.r: possible[i.value] = False elif i.c == b.c: possible[i.value] = False nlist = [] for n in range(1,10): if possible[n]: nlist.append(n) if len(nlist) == 1: b.value = nlist[0] elif len(nlist) > 1: b.value = random.choice(nlist)
99 percent of computer problems exists between chair and keyboard.