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 34
|
from tkinter import *
from tkinter import tix
class Frame_Ajouter(tix.Frame):
def __init__(self,master=None):
tix.Frame.__init__(self,master,width=400,height=100,bg="yellow")
tix.Label(self,text="Rubrique:",bg="yellow").grid(row=0,column=0,sticky=E,ipady=10)
tix.Label(self,text="Nom :",bg="yellow").grid(row=1,column=0,sticky=E,ipady=10)
tix.Label(self,text="Prénom :",bg="yellow").grid(row=2,column=0,sticky=E,ipady=10)
var = tix.StringVar()
self.liste = tix.ComboBox(self, dropdown=1, editable=0, variable=var, options='listbox.height 6 label.anchor e')
self.liste.grid(row=0,column=1,sticky=W,padx=10)
self.BTN_Ajout= tix.Button(self,text="+",width=5)
self.BTN_Ajout.grid(row=0,column=2)
self.entre2=tix.Entry(self,width=30)
self.entre2.grid(row=1,column=1,columnspan=2,sticky=W,padx=10)
self.entre3=tix.Entry(self,width=30)
self.entre3.grid(row=2,column=1,columnspan=2,sticky=W,padx=10)
self.liste.entry.config(width=15, state='readonly',bg='white')
self.liste.subwidget("label" ).destroy()
self.liste.subwidget("frame").config( bg = "yellow" )
self.liste.insert(tix.END, 'Liste')
self.liste.insert(tix.END, 'January')
self.liste.insert(tix.END, 'February')
self.liste.pick(0)
if __name__ == '__main__':
fen=tix.Tk()
frame =Frame_Ajouter()
frame.pack()
fen.mainloop() |
Partager