[Tkinter] passing data to messagebox - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] passing data to messagebox (/thread-16186.html) |
passing data to messagebox - kmusawi - Feb-18-2019 I have 2 python scripts performing messaging over socket connection. It works fine via CLI however I am now trying to display the receiver end data message via tkinter in a messagebox. My problem is when the message is received I dont know how to break the while loop when pressing OK on the messagebox. I also need to make sure the incoming socket connection is not interrupt, ie- after closing the messagebox the receiver waits for the next incoming message. Python code at receiver end : # Save as server.py # Message Receiver import os from socket import * import tkinter as tk import tkinter.messagebox root = tk.Tk() host = "" port = 13000 buf = 1024 addr = (host, port) UDPSock = socket(AF_INET, SOCK_DGRAM) UDPSock.bind(addr) print ("Waiting to receive messages...") (data, addr) = UDPSock.recvfrom(buf)\ while True: tkinter.messagebox.showinfo('Duress Message', data) |