Hi
Im trying to do a number sequence generator. where i got 4 textboxes where i can chose the numbers it will do a sequens between. say i chose 401 in textbox1 and 405 in textbox2 and 501 in textbox3 and in textbox4 505 the result print will be like
example1
401-501
501-401
402-502
502-402
403-503
503-403
and so on....
The code i wrote now is meant to print a sequence like example 2. But its doesent work. i get strange number sequences.
example2
401-501
402-502
and so on....
But i dont know if its possible to do it like example1 which i would like to have it like.
Im trying to do a number sequence generator. where i got 4 textboxes where i can chose the numbers it will do a sequens between. say i chose 401 in textbox1 and 405 in textbox2 and 501 in textbox3 and in textbox4 505 the result print will be like
example1
401-501
501-401
402-502
502-402
403-503
503-403
and so on....
The code i wrote now is meant to print a sequence like example 2. But its doesent work. i get strange number sequences.
example2
401-501
402-502
and so on....
But i dont know if its possible to do it like example1 which i would like to have it like.
from tkinter import *
import tkinter as tk
class StatusBar(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.label = Label(self, bd=1, relief=SUNKEN, anchor=W)
self.label.pack(fill=X)
def set(self, format, *args):
self.label.config(text=format % args)
self.label.update_idletasks()
def clear(self):
self.label.config(text="")
self.label.update_idletasks()
def funktion(self):
value1 = (a1.get())
value2 = (a2.get())
value3 = (b1.get())
value4 = (b2.get())
for a in range(value1, value2+1):
for b in range(value3, value4+1):
print('{}-{}\n'.format(a, b))
if __name__ == "__main__":
root = Tk()
Frame(root, width=400, height=200).pack()
status = StatusBar(root)
status.pack(side=BOTTOM, fill=X)
a1 = IntVar()
a2 = IntVar()
b1 = IntVar()
b2 = IntVar()
sida1från_entry = tk.Entry(root, font=('Helvetica', 12, 'bold'), textvariable=a1)
sida1från_entry.pack( fill=X)
sida1till_entry = tk.Entry(root, font=('Helvetica', 12, 'bold'), textvariable=a2)
sida1till_entry.pack(fill=X)
sida2från_entry = tk.Entry(root, font=('Helvetica', 12, 'bold'), textvariable=b1)
sida2från_entry.pack( fill=X)
sida2till_entry = tk.Entry(root, font=('Helvetica', 12, 'bold'), textvariable=b2)
sida2till_entry.pack(fill=X)
button1 = tk.Button(root, text="Make", command=status.funktion, width = 5)
button1.pack( fill=X)
root.update()
root.mainloop()
