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
| #!/usr/bin/python
# -*- coding: utf-8 -*-
#
#
from Tkinter import *
window1 = Tk()
mavar=IntVar()
def Un():
mavar.set(1)
def Deux():
mavar.set(2)
def Trois():
mavar.set(3)
def Fonction_globale():
print ('Premiere partie')
print ('Attente de mavar')
window1.wait_variable(mavar)
print ('mavar a changer')
print('sa valeur est', mavar.get())
print ('suite du code')
b1 = Button(window1, text='1', command=Un)
b1.pack()
b2 = Button(window1, text='2', command=Deux)
b2.pack()
b3 = Button(window1, text='3', command=Trois)
b3.pack()
b4 = Button(window1, text='4', command=Fonction_globale)
b4.pack()
window1.mainloop() |
Partager