Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2684 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  Modules et programme principal

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Modules et programme principal

n°1196680
Yoha2
Un bug peut en cacher un autre
Posté le 10-09-2005 à 18:25:18  profilanswer
 

J'ai créé un module graph qui appelle Tkinter et qui définie la fonction cercle(). Elle doit dessiner un cercle dans le canevas appelé "can". Mais le problème: il ne peut pas accéder aux éléemnts programme principal (canevas). La fonction est:  
def cercle(x, y, r, coul=black):
          can.create_oval(x-r, y-r, x+r, y+r, fill=coul)
 

mood
Publicité
Posté le 10-09-2005 à 18:25:18  profilanswer
 

n°1196880
masklinn
í dag viðrar vel til loftárása
Posté le 11-09-2005 à 10:06:04  profilanswer
 

tu lui files une référence vers le canevas [:petrus75]


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°1196908
Yoha2
Un bug peut en cacher un autre
Posté le 11-09-2005 à 11:20:01  profilanswer
 

??? C'est à dire ?

n°1196917
masklinn
í dag viðrar vel til loftárása
Posté le 11-09-2005 à 11:37:46  profilanswer
 

ben si ta fonction cercle n'a pas accès au canevas, comment tu veux qu'elle y trace quoi que ce soit [:petrus dei]


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°1197020
Yoha2
Un bug peut en cacher un autre
Posté le 11-09-2005 à 13:58:46  profilanswer
 

Justement, comment faire pour qu'elle y ai accès ?

n°1197035
masklinn
í dag viðrar vel til loftárása
Posté le 11-09-2005 à 14:12:58  profilanswer
 

ben tu files une référence à ton canevas en paramètre de ta fonction [:petrus75]
 
Ou alors tu fais en sorte que la fonction soit une méthode du canevas (et dans ce cas au lieu d'appeler "cercle" tu appelles "canevas.cercle" )


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°1197068
Yoha2
Un bug peut en cacher un autre
Posté le 11-09-2005 à 14:37:03  profilanswer
 

Ah. Je comprends. Je vais essayer. Merci

n°1197071
Yoha2
Un bug peut en cacher un autre
Posté le 11-09-2005 à 14:39:42  profilanswer
 

Ouinn: Erreur sur le point.

n°1197072
Yoha2
Un bug peut en cacher un autre
Posté le 11-09-2005 à 14:40:09  profilanswer
 

(sintax error)

n°1197108
masklinn
í dag viðrar vel til loftárása
Posté le 11-09-2005 à 15:40:05  profilanswer
 

mégné?


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
mood
Publicité
Posté le 11-09-2005 à 15:40:05  profilanswer
 

n°1198776
Yoha2
Un bug peut en cacher un autre
Posté le 13-09-2005 à 18:05:23  profilanswer
 

On peut reprendr depuis le début ?
Je veux créer une fonction dans un module appelé graph appelée cercle() qui accède à une fenêtre du programme principale appelé fen, puis à son widget esclve, un canevas appelé can.

n°1198784
masklinn
í dag viðrar vel til loftárása
Posté le 13-09-2005 à 18:17:22  profilanswer
 

Ah, ben ouais, tu fais en sorte que ta fonction cercle() prenne un canevas en paramètre [:spamafote]


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°1199228
Yoha2
Un bug peut en cacher un autre
Posté le 14-09-2005 à 11:52:27  profilanswer
 

oui, je peux l'enregistrer dans une variable can mais comment l'utiliser après ?

n°1199304
masklinn
í dag viðrar vel til loftárása
Posté le 14-09-2005 à 13:30:44  profilanswer
 

[:petrus75]

def cercle(canevas, x, y, r, coul=black):
          canevas.create_oval(x-r, y-r, x+r, y+r, fill=coul)


C'est vraiment à ce point compliqué [:petrus dei]


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°1199966
Yoha2
Un bug peut en cacher un autre
Posté le 15-09-2005 à 08:55:43  profilanswer
 

C'est... que je suis plutôt débutant... :p


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  Modules et programme principal

 

Sujets relatifs
créer une IHM pour mon programme en Fortrandécortiquer un programme .exe
Illustrations dans un programmeun ch'tit programme "rapport surface disque dispo"
utiliser PL/SQL dans un programme javaProbléme pour éxecuter programme
Un programme français du style de Zend Platform ?programme java pour envoyer des mails
mesure de performance d'un programmeSauter une ligne dans un programme
Plus de sujets relatifs à : Modules et programme principal


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR