i'm making an online version of MS PAINT in python, and i'm having trouble when i'm trying to transfer the X and Y of the brush to the server.instead of going one by one, its messy
instead of going one by one, its messy
that's how i send:
def paint(self, event):
self.line_width = self.choose_size_button.get()
paint_color = 'white' if self.eraser_on else self.color
if self.old_x and self.old_y:
self.c.create_line(self.old_x, self.old_y, event.x, event.y,
width=self.line_width, fill=paint_color,
capstyle=ROUND, smooth=TRUE, splinesteps=36)
self.old_x = event.x
self.old_y = event.y
data = (str(self.old_x) + "," + str(self.old_y) + "," + paint_color + "," + str(self.line_width))
my_socket.send(data.encode())
and that's how i recieve in the server:
for sock in rlist:
if sock is listening_socket:
client_socket, addr = listening_socket.accept()
open_sockets.append(client_socket)
print ("opensockets=", open_sockets)
else:
data = sock.recv(1024).decode()
print(data)
if data == "quit":
quit_sock(sock)
else:
send_xy(data, sock)