1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| from tkinter import *
root = Tk()
root.geometry('500x500')
n=1
az = "but_frame" + str(n)
az = Frame(root)
Button(az, text='XXX',command=None, fg='white', bg='green').pack(side=LEFT)
Button(az, text='XXX',command=root.quit, bg='red', fg='white').pack(side=LEFT)
az.pack()
n=n+1
az = "but_frame" + str(n)
az = Frame(root)
Button(az, text='YYY', fg='white', bg='green', command=None).pack(side=LEFT)
Button(az, text='YYY',command=root.quit, bg='red', fg='white').pack(side=LEFT)
az.pack()
root.mainloop() |
Partager