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
| from tkinter import tix, Frame, Button, Label, Entry, Text, StringVar, messagebox
from tkinter import *
from tkinter.constants import *
class Print(Frame):
def __init__(self):
Frame.__init__(self)
self.i = 0
self.boucle = None
self.on_commence()
def on_commence(self):
print(self.i)
self.i = self.i + 1
if self.i == 5:
self.termine()
self.boucle = self.after(1000, self.on_commence)
def termine(self):
self.after_cancel(self.boucle)
self.i = 0
print("pourquoi ça n'arrete pas la boucle :",self.boucle)
if __name__=="__main__":
app = tix.Tk()
essai= Print()
app.mainloop() |
Partager