多数の組み合わせを見つけるために itertools.combinations モジュールを使用しています。私のプログラムはすべての組み合わせ (それらの多く) を見つけますが、すべての組み合わせの合計が何らかの数値になるかどうかをチェックし、その組み合わせをリストに保存します。
from itertools import *
from math import *
import Tkinter as tk
import ttk
x = int(raw_input('Enter number of combinations: '))
z = int(raw_input('Enter sum number: '))
def combinator():
comb = combinations(range(100), x)
for i in comb:
yield i
my_combinations = []
combination_s = combinator()
for i in combination_s:
print i
c = list(i)
if fsum(c)==z:
my_combinations.append(c)
print my_combinations
root = tk.Tk()
root.title('ttk.Progressbar')
pbar = ttk.Progressbar(root, length=300, mode='determinate', maximum = 100)
pbar.pack(padx=5, pady=5)
root.mainloop()
プログラムが組み合わせの合計を評価するたびに進行状況を示す ttk.progressbar が必要です。どうやってやるの?