Derniers sujets | » chefs et officiersMer 06 Nov 2013, 10:53 par Dramdun» suivi SWOTORVen 26 Avr 2013, 09:41 par nikodor» CV du blackPhoenixMar 12 Mar 2013, 20:37 par BlackPhoenix » Candidature GootrekVen 08 Fév 2013, 15:03 par yamane » A mon grand regretJeu 07 Fév 2013, 19:50 par Dramdun» La Charte de confrérieJeu 07 Fév 2013, 09:37 par DonNoNO » RecrutementMar 05 Fév 2013, 07:33 par yamane » Annulation Helegrod de vendredi 01/02/213, remplacé par AnnuminasVen 01 Fév 2013, 10:38 par nikodor» Nettoyage du livre des prouessesVen 25 Jan 2013, 23:26 par titebabs |
| | a tout hazrd! | |
| | Auteur | Message |
---|
Dramdun
Messages : 84 Date d'inscription : 07/05/2012 Age : 49 Localisation : caen (14)
| Sujet: a tout hazrd! Mer 24 Oct 2012, 17:02 | |
| quelqu'un aurait une idee sur le bug? - Code:
-
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> from functools import partial >>> import tkinter as tk >>> >>> root = tk.Tk()
>>> class Allo_IHM(object): def __init__(self, fic): self.phoneList = [] self.fic = fic f = open(fic) try: for line in f: self.phoneList.append(line[: -1].split('*')) except: f = open(self.fic, "w") finally: f.close() self.phoneList.sort() self.root = tk.Tk() self.root.title("Allo !") self.root.config(relief=tk.RAISED, bd=3) self.makeWidgets() self.root.mainloop() def makeWidgets(self): # frame "saisie" (en haut avec bouton d'effacement) frameH = tk.Frame(self.root, relief=tk.GROOVE, bd=2) frameH.pack() tk.Label(frameH, text="Nom :").grid (row=0, column=0, sticky=tk.W) self.nameEnt = tk.Entry(frameH) self.nameEnt.grid(row=0, column=1, sticky=tk.W, padx=5, pady=10) tk.Label (framH, text="tel :").grid(row=1, column=0, sticky=tk.W) self.phoneEnt = tk.Entry(frameH) self.phoneEnt.grid(row=1, column=1, sticky=tk.W, pasx=5, pady=2) b = tk.button(frameH, text="Effacer ", command=self.clear) b.grid(row=2, column=0, columnspan=2, pady=3) # frame "liste" (au milieu) frameM = tk.Frame(self.root) frameM.pack() self.scroll = tk.Scrollbar(frameM) self.select = tk.Listbox(frameM, yscrollcommand=self.scroll.set, height=6) self.scroll.config(command=self.select.yview) self.scroll.pack(side=tk.RIGHT, fill=tk.Y, pady=5) self.select.pack(side=tk.LEFT, fill=tk.BOTH, expand=1, pady=5) ## remplissage de la listbox for i in self.phoneList: self.select.insert(tk.END, i[0]) self.select.bind("<Double-Button-1>", lambda event: self.afficher(event)) # frame "boutons" (en bas) frameB = tk.Frame(self.root, relief=tk.GROOVE, bd=3) frameB.pack(pady=3) b1 = tk.Button(frameB, text="Ajouter ", command=self.ajouter) b2 = tk.Button(frameB, text="Supprimer", command=self.supprimer) b3 = tk.Button(frameB, text="Afficher ", command=self.afficher) b1.pack(side=tk.LEFT, pady=2) b2.pack(side=tk.LEFT, pady=2) b3.pack(side=tk.LEFT, pady=2) def ajouter(self): pass def supprimer(self): pass def afficher(self, event=None): pass def clear(self): pass
#auto-test ----------------------------------------------------------------------------------------------------------------------------- if __name__== '__main__': app = Allo_IHM('phones.txt')
| |
| | | ElysiuM
Messages : 79 Date d'inscription : 09/05/2012 Age : 37 Localisation : Belgique
| Sujet: Re: a tout hazrd! Mer 24 Oct 2012, 17:49 | |
| Absolument aucune dram, mais je répond pour te faire savoir que le message a quand même été lu | |
| | | ikeny
Messages : 7 Date d'inscription : 25/10/2012
| Sujet: Re: a tout hazrd! Jeu 25 Oct 2012, 20:03 | |
| merci ely... j'avais quand meme peu d'espoir de trouver une solution aussi facilement... bref vous m'aurais reconnu = DRAM! vi j'ai oublier mon mot de pass alors nouveau compte!!! quand on a pas de tete... | |
| | | nikodor
Messages : 116 Date d'inscription : 04/05/2012
| Sujet: Re: a tout hazrd! Ven 26 Oct 2012, 19:54 | |
| voilà ce que l'on peut traduire : , et . mais !!! et voir aussi ! A = . sinon, ben....démerde toi tout seul MOUHAHAHAHAHAHAHAHAHA !!!! | |
| | | ElysiuM
Messages : 79 Date d'inscription : 09/05/2012 Age : 37 Localisation : Belgique
| Sujet: Re: a tout hazrd! Dim 28 Oct 2012, 08:35 | |
| | |
| | | ikeny
Messages : 7 Date d'inscription : 25/10/2012
| Sujet: Re: a tout hazrd! Dim 04 Nov 2012, 17:03 | |
| on peut fermé le post, probleme resolu l'anomalie venait de l'interpreteur....
merci | |
| | | Skaronte
Messages : 63 Date d'inscription : 14/05/2012 Age : 32
| Sujet: Re: a tout hazrd! Lun 05 Nov 2012, 13:23 | |
| Au moins niko peut faire semblant de comprendre et d'être intelligent ^^ | |
| | | ikeny
Messages : 7 Date d'inscription : 25/10/2012
| Sujet: Re: a tout hazrd! Mar 06 Nov 2012, 16:35 | |
| juste histoir, un petit programme qui sert a rien, et qui tape sur les nerfs au bout d'un moment, la balle ne fait que de se promener dans la fenetre: - Citation :
- Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2 Type "copyright", "credits" or "license()" for more information. ==== No Subprocess ==== >>> from Tkinter import * >>> >>> # Définition des gestionnaires d'événements : >>> def move(): "déplacement de la balle" global x1, y1, dx, dy, flag x1, y1, = x1 +dx, y1 +dy if x1 > 210: x1, dx, dy = 210, 0, 15 if y1 > 210: y1, dx, dy = 210, -15, 0 if x1 < 10: x1, dx, dy = 10, 0, -15 if y1 < 10: y1, dx, dy = 10, 15, 0 can1.coords(oval1,x1,y1,x1+30,y1+30) if flag > 0: fen1.after(50,move) # Boucler après 50 millisecondes
>>> def stop_it(): "arret de l'animation" global flag flag = 0
>>> def start_it(): "démarrage de l'animation" global flag if flag == 0: # Pour ne lancer qu'une seule boucle flag = 1 move()
>>> # --------------- Programme Principal --------------- >>> # Les variables suivantes seront utilisées de manière globale : >>> x1, y1 = 10, 10 # coordonnées initiales >>> dx, dy = 15, 0 # 'pas' du déplacement >>> flag = 0 # commutateur >>> # Création du widget principal ("parent"): >>> fen1 = Tk() >>> fen1.title("Animation automatique avec Tkinter") '' >>> # Création des widgets "enfants": >>> can1 = Canvas(fen1, bg='dark grey', height=250, width=250) >>> can1.pack(side=LEFT, padx=5, pady=5) >>> oval1 = can1.create_oval(x1, y1, x1+30, y1+30, width=2, fill='red') >>> bou1 = Button(fen1, text='Quitter', width =8, command=fen1.quit) >>> bou1.pack(side=BOTTOM) >>> bou2 = Button(fen1, text='Démarrer', width =8, command=start_it) >>> bou2.pack() >>> bou3 = Button(fen1, text='Arrêter', width =8, command=stop_it) >>> bou3.pack() >>> # Démarrage du réceptionnaire d'événements (boucle principale) : >>> fen1.mainloop() [img] [/img] | |
| | | Contenu sponsorisé
| Sujet: Re: a tout hazrd! | |
| |
| | | | a tout hazrd! | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |