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 29 30 31 32 33
| From Tkinter import *
def change_police(event) :
a=pol_list.curselection()
b=pol_list.get(a)
i.set(b)
panneau.configure(font=i.get())
def style () :
x.set()#Je ne sais pas quoi mettre comme argument car x.set() en requière un
panneau.configure(font=x.get())
style_name=['normal','italic', 'bold','bold italic']
style_value=['normal','italic', 'bold','bold italic']
fen=Tk()
i=StringVar()
x=StringVar()
x.set('italic')
panneau=Lable(fen, text='Test')
pol_list=Listbox(fen)
pol_list.insert(0, Arial)
pol_list.insert(1, Courrier)
pol_list.insert(2, Comic)
pol_list.insert(3, Fixedsys) #etc...
pol_list.bind("<Button-1>", change_police)
for n in range(4) :
rad_bout=Radiobutton(fen, text=style_name[n], value=style_value[n], variable=x, command= style)
rad_bout.pack()
panneau.pack()
poli_list.pack()
mainloop() |
Partager