Sep-11-2020, 07:16 AM
Thanks everyone, I have managed to create variables using for loop with dictionaries as bowlofred mentioned:
def picking_gui(): number=count_unique_devices(myConnection) print("number=",number) global devices devices = {} for x in range(1,number): devices["device{0}".format(x)] = canvas_tk.create_rectangle(20+(x*90),400,90+(x*90),470,fill='red') name_text = "device"+str(x) canvas_tk.create_text(55+(x*90),435,text=name_text) if(x>10): devices["device{10}".format(x)] = canvas_tk.create_rectangle(20+(x*90),500,90+(x*90),570,fill='red')I now will have a look at how to create my GUI using OOP aproach as I have never used it before. It seems more complex than the usual program flow I am used to