#!/usr/bin/python3 from tkinter import * from socket import * from struct import * from _thread import start_new_thread class lurk_demo_frame(Frame): def __init__(self, master): Frame.__init__(self, master) self.pack(fill='both', expand=1) self.textwindow = Frame(self) self.controls = Frame(self) self.controls.pack(side=RIGHT) self.textwindow.pack(side=LEFT, fill='both', expand=1) self.output_editor = Text(self.textwindow) self.output_editor.config(font=('Monospace', 14)) self.output_editor.pack(fill='both', expand=1) self.entry_editor = Text(self.textwindow) self.entry_editor.config(font=('Monospace', 14)) self.entry_editor.pack(fill='both', expand=1) self.connect_button = Button(self.controls, text="Connect", command=self.connect ) self.connect_button.pack() self.character_button = Button(self.controls, text="Send Character", command=self.character) self.character_button.pack() def connect(self): hostname, port = self.entry_editor.get(1.0, "end").split() self.output_editor.insert("end", "Connection to server: " + hostname + " port " + port + "\n") self.skt = socket(AF_INET, SOCK_STREAM) self.skt.connect((hostname, int(port))) # if port isn't an integer, this probably crashes version = self.skt.recv(5) version_format = "