| 12
 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
 
 |  
#-*-coding: Utf-8 -*-
 
## MODULES IMPORTER ##
import os, sys, socket
from tkinter import *
from tkinter.messagebox import *
 
class Application(Tk):
    def __init__(self):
        Tk.__init__(self,)
        self['bg']="yellow"
        self.ent =Entry(self, width =31,).pack()
        Button(self, text ="Connect", comman =self.connect).pack()
        self.can =Canvas(self, width =711, height =311, bg="light yellow")
        self.can.pack(padx=6, pady =6)
        Button(self, text ="Entre", command =self.send).pack()
 
    def connect(self):
        PORT =19111
        self.ent =self.ent
        try:
            self =socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.connect(("", PORT))
        except:
            showinfo("Socket Error", "La machine distante est injoignable")
 
    def send(self):
        while 1:
            if msgServeur.upper() =="Attention" or msgServeur =="tchip":
                break
 
            print(msgServeur)
            msgClient = input("CMD *> ")
            mySocket.send(msgClient.encode("ISO-8859-15"))
            msgServeur = mySocket.recv(1024).decode("ISO-8859-15")
 
app = Application()
app.mainloop() | 
Partager