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
| # -*- coding:Latin-1 -*-
import serial
from Tkinter import *
def allumer(e=0):
ser = serial.Serial()
ser.port=6
ser.baudrate=19200
ser.bytesize=8
ser.parities=0
ser.stopbits=1
ser.timeout=1
d= (chr(0x02),chr(0x00),chr(0x00),chr(0x00),chr(0x00),chr(0x02))
ser.open()
print ser
y=ser.write('d\r\n')
print y
ser.close()
fen2=Tk()
Label(fen2, text='Données envoyer').pack()
Button(fen2, text='Quitter', command =fen2.destroy).pack()
def eteindre():
fen2=Tk()
Label(fen2, text='Données envoyer').pack()
Button(fen2, text='Quitter', command =fen2.destroy).pack()
fen1=Tk()
tex1=Label(fen1, text='bonjour tout le monde !', fg='black')
tex1.pack()
bou2=Button(fen1, text='Allumer le vidéo-projecteur', command=allumer)
bou2.pack()
bou3=Button(fen1, text='Eteindre le vidéo-projecteur', command =eteindre)
bou3.pack()
bou1=Button(fen1, text='Quitter', command = fen1.destroy)
bou1.pack()
fen1.mainloop() |
Partager