Bonjour Madame, Monsieur,
Je me permets de tourner vers vous. Cela fait longtemps que je suis bloqué sur un problème callback avec tkinter. Le but c'est de créer un système bancaire pour la gestion du compte. Je suis qu'au début, mais je n'arrive pas régler mon problème.Je dois utiliser l'héritage et classe, c'est pour cela je me suis lancé dnc cette configuration. Pouvez - vous me dire où de trouve ma faute ? Ce sera un grand aide.
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
35
36
37
38
39
40 from tkinter import * import tkinter as tk class Application(tk.Tk): def __init__(self): tk.Tk.__init__(self) self.creer_widgets() self.nom1 = "" self.compte = 0 self.v = "" def creer_widgets(self): self.nom1 = StringVar() self.label = tk.Label(self, text = "Compte Banquaire") self.entree = tk.Entry(self, textvariable = self.nom1) self.bouton = tk.Button(self, text = "Entrer", command = Gestion.gest_nom) self.v = self.nom1.get() self.label.pack() self.entree.pack() self.bouton.pack() class Gestion(Application): def __init__(self): Application.__init__(self) def gest_nom(self): print(self.v) if __name__=="__main__": app = Application() app.mainloop()
erreur :
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.8/tkinter/__init__.py", line 1892, in __call__
return self.func(*args)
TypeError: gest_nom() missing 1 required positional argument: 'self'
Partager