self.frame_valeur.pack(fill='both',expand=1)
self.frame_valeur.bind("<Button-3>",lambda e,s=self,a=bulle_aide : s.parent.appli.affiche_aide(e,a))
self.frame_valeur.bind("<ButtonRelease-3>",self.parent.appli.efface_aide)
- self.label = Label(self.frame_valeur,text='Valeur :')
- self.label.place(relx=0.1,rely=0.7)
+ self.label = Label(self.frame_valeur,text='Complexe de la forme : a+bj')
+ self.label1 = Label(self.frame_valeur,text='Imaginaire')
+ self.label2 = Label(self.frame_valeur,text='Phase')
+ self.label3 = Label(self.frame_valeur,text='OU')
+ self.label.place (relx=0.15,rely=0.1)
+ self.label1.place(relx=0.6,rely=0.50)
+ self.label2.place(relx=0.6,rely=0.57)
+ self.label3.place(relx=0.15,rely=0.4)
self.typ_cplx=StringVar()
self.typ_cplx.set('RI')
- rb1 = Radiobutton(self.frame_valeur, text='RI',variable=self.typ_cplx,value='RI')
- rb2 = Radiobutton(self.frame_valeur, text='MP',variable=self.typ_cplx,value='MP')
- rb1.place(relx=0.05,rely = 0.6)
- rb2.place(relx=0.05,rely = 0.8)
+ rb1 = Radiobutton(self.frame_valeur, text='RI : Réel',variable=self.typ_cplx,value='RI')
+ rb2 = Radiobutton(self.frame_valeur, text='MP : Module',variable=self.typ_cplx,value='MP')
+ rb1.place(relx=0.15,rely = 0.50)
+ rb2.place(relx=0.15,rely = 0.57)
self.entry1 = Pmw.EntryField(self.frame_valeur,validate='real')
self.entry2 = Pmw.EntryField(self.frame_valeur,validate='real')
self.entry3 = Pmw.EntryField(self.frame_valeur)
self.entry2.component('entry').bind("<KP_Enter>",lambda e,c=self.valid_valeur:c())
self.entry3.component('entry').bind("<Return>",lambda e,c=self.valid_complexe:c())
self.entry3.component('entry').bind("<KP_Enter>",lambda e,c=self.valid_complexe:c())
- self.entry1.place(relx=0.27,rely = 0.7,relwidth=0.35)
- self.entry2.place(relx=0.65,rely = 0.7,relwidth=0.35)
- self.entry3.place(relx=0.27,rely = 0.4,relwidth=0.60)
+ self.entry1.place(relx=0.15,rely = 0.65,relwidth=0.35)
+ self.entry2.place(relx=0.60,rely = 0.65,relwidth=0.35)
+ self.entry3.place(relx=0.15,rely = 0.20,relwidth=0.60)
self.entry1.focus()
+ self.bouton_val=Button(self.frame_valeur,text="Valider",command=self.valider,width=14)
+ self.bouton_val.place(relx=0.4,rely=0.8)
self.frame_valeur.update()
self.aide = Label(self.frame_valeur,
text = aide,
# affichage de la valeur du MCS
self.display_valeur()
+ def valider(self):
+ if ((self.entry3.get() != None) and (self.entry3.get() != "" )):
+ self.erase_valeur()
+ self.valid_complexe()
+ else :
+ self.valid_valeur()
+
+
def display_valeur(self):
"""
Affiche la valeur de l'objet pointé par self
"""
l=[]
l.append(self.typ_cplx.get())
- l.append(string.atof(self.entry1.get()))
- l.append(string.atof(self.entry2.get()))
+ try :
+ l.append(string.atof(self.entry1.get()))
+ l.append(string.atof(self.entry2.get()))
+ except :
+ return None
return `tuple(l)`
def erase_valeur(self):