Hi, i am in a spot of trouble trying to do this:
I want to create a number of (tkinter) windows dynamically and simultaneously (between 2 and 10).
Each window has a button, when pressed, destroys the window.
The purpose is a selection process, because the windows will show images of things the user must choose between.
In pinciple this is not so difficult, just repeat 10 times win1 ... win10:
But in python country, you would want to do this more compact, in a loop !, like so:
Help?
Paul
I want to create a number of (tkinter) windows dynamically and simultaneously (between 2 and 10).
Each window has a button, when pressed, destroys the window.
The purpose is a selection process, because the windows will show images of things the user must choose between.
In pinciple this is not so difficult, just repeat 10 times win1 ... win10:
win1 = Tk() win1.title('image x') geo = '1000x1000+0+0' win1.geometry(geo) Button(win1, text='Select', command = WIN1).pack(side = BOTTOM) -> the "def WIN1:" has code win1.destroy and do some other stuff.................
But in python country, you would want to do this more compact, in a loop !, like so:
winList = ['winA', 'winB', 'winC', 'winD', 'winE', 'winF', 'winG', 'winH', 'winI', 'winJ'] for item in winList: item = Tk() geo = '1000x1000+0+0' item.geometry(geo) Button(item, text = 'Delete',command= lambda: WIN(item)).pack(side = BOTTOM)Here lies the problem, because i'm having trouble in the command parameter to point to one def clause, whilst identifying the window to delete.
Help?
Paul