From b62d6adc5e487212bc94bcfde8fb7f289ce1c433 Mon Sep 17 00:00:00 2001 From: snsd0805 Date: Mon, 29 Jun 2020 01:13:30 +0800 Subject: [PATCH] Show problem on GUI --- draw.py | 11 +++++++++-- main.py | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/draw.py b/draw.py index f3a5a3f..e21ee1b 100644 --- a/draw.py +++ b/draw.py @@ -22,9 +22,16 @@ def drawerReceive(sock,screen): if data[0:6] == "[list]": drawUserList(data,screen) -def sendDraw(sock,nowUserList,screen): +def sendDraw(sock,nowUserList,screen,problem): + + # Set white background screen.fill((255, 255, 255)) - + + # Set problem font + pgStringVar = pygame.font.Font(None,30).render("Problem: {}".format(problem),False,(0,0,0))# 文字物件 + screen.blit(pgStringVar,(30,450)) + + white= (255, 255, 255) black= (0, 0, 0) clock= pygame.time.Clock() diff --git a/main.py b/main.py index 07915cb..c7daba3 100644 --- a/main.py +++ b/main.py @@ -235,9 +235,10 @@ class Client: while not continueFlag: data = sock.recv(1024).decode('utf-8') role = data[1:5] + problem = data.split(' ')[1] #print("Role: ",role) if role == "prob": - draw.sendDraw(sock,userList,screen) + draw.sendDraw(sock,userList,screen,problem) continueFlag = True elif role == "gues": draw.receiveDraw(sock,screen)