def outexcel(self):
xls = xlsxwriter.Workbook(self.entry_path.get())
bold = xls.add_format({'bold': 0, "color": "black", "font_size": 15})
worksheet = xls.add_worksheet('Sheet1')
for i in range(len(self.lst_out)):
worksheet.write_string('A' + str(i+1), self.lst_out, bold)
xls.close()
pass
def generate_arithmetic(self, var, min_max):
list = []
if var[0] == 1:
list.append('+')
if var[1] == 1:
list.append('-')
if var[2] == 1:
list.append('x')
if var[3] == 1:
list.append('÷')
op = random.choice(list)
num1 = random.randint(int(min_max[0]), int(min_max[1]))
num2 = random.randint(int(min_max[0]), int(min_max[1]))
question = f"{num1} {op} {num2} ="
return question
def getvar(self):
var = (self.var_add.get(), self.var_sub.get(), self.var_mul.get(), self.var_div.get())
range = (self.entry_min.get(), self.entry_max.get())
return var, self.entry_sum.get(), range
pass
def showtable(self):
var, sum, min_max = self.getvar()
self.lst_out = []
for i in range(int(sum)):
ques = self.generate_arithmetic(var, min_max)
self.lst_out.append(ques)
pass