Lock text box, change some tkinter conf to remove useless import, change default command suffix
This commit is contained in:
parent
648d4ac8e1
commit
175e6b55e9
2 changed files with 9 additions and 7 deletions
12
gui.py
12
gui.py
|
@ -1,4 +1,4 @@
|
|||
from tkinter import Tk, Frame, Scrollbar, Label, Text, Button, Entry, StringVar, IntVar, LEFT, RIGHT, BOTH, Y, END
|
||||
from tkinter import Tk, Frame, Scrollbar, Label, Text, Button, Entry, StringVar, IntVar
|
||||
from tkinter.messagebox import showerror
|
||||
from client import Client
|
||||
from threading import Thread
|
||||
|
@ -29,7 +29,9 @@ def receive():
|
|||
break
|
||||
if msg[-1:] != "\n":
|
||||
msg += "\n"
|
||||
chat_message.insert(END, msg)
|
||||
chat_message.configure(state="normal")
|
||||
chat_message.insert("end", msg)
|
||||
chat_message.configure(state="disable")
|
||||
|
||||
|
||||
def send(event=None):
|
||||
|
@ -57,9 +59,9 @@ tchat.protocol("WM_DELETE_WINDOW", on_closing)
|
|||
chat = Frame(tchat)
|
||||
chat.pack()
|
||||
scrollbar = Scrollbar(chat)
|
||||
scrollbar.pack(side=RIGHT, fill=Y)
|
||||
chat_message = Text(chat, height=15, width=50, yscrollcommand=scrollbar.set)
|
||||
chat_message.pack(side=LEFT, fill=BOTH)
|
||||
scrollbar.pack(side="right", fill="y")
|
||||
chat_message = Text(chat, height=15, width=50, yscrollcommand=scrollbar.set, state="disable")
|
||||
chat_message.pack(side="left", fill="both")
|
||||
Thread(target=receive).start()
|
||||
|
||||
entry = Frame(tchat)
|
||||
|
|
|
@ -10,8 +10,8 @@ class Server(Socket):
|
|||
self.socket.bind((host, port))
|
||||
self.socket.listen(5)
|
||||
self.service_id = service_id
|
||||
self.command_suffix = "!"
|
||||
self.welcom_msg = "Welcom ! Type \"!help\" to see commands and \"quit\" to exit"
|
||||
self.command_suffix = "/"
|
||||
self.welcom_msg = "Welcom ! Type \"/help\" to see commands and \"quit\" to exit"
|
||||
self.commands = {"help": self.command_help, "players list": self.command_players_list}
|
||||
self.clients = dict()
|
||||
print("Wait for connexion...")
|
||||
|
|
Reference in a new issue