Show problem on GUI
This commit is contained in:
parent
1a68e3b3dd
commit
b62d6adc5e
11
draw.py
11
draw.py
@ -22,9 +22,16 @@ def drawerReceive(sock,screen):
|
|||||||
if data[0:6] == "[list]":
|
if data[0:6] == "[list]":
|
||||||
drawUserList(data,screen)
|
drawUserList(data,screen)
|
||||||
|
|
||||||
def sendDraw(sock,nowUserList,screen):
|
def sendDraw(sock,nowUserList,screen,problem):
|
||||||
|
|
||||||
|
# Set white background
|
||||||
screen.fill((255, 255, 255))
|
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)
|
white= (255, 255, 255)
|
||||||
black= (0, 0, 0)
|
black= (0, 0, 0)
|
||||||
clock= pygame.time.Clock()
|
clock= pygame.time.Clock()
|
||||||
|
|||||||
3
main.py
3
main.py
@ -235,9 +235,10 @@ class Client:
|
|||||||
while not continueFlag:
|
while not continueFlag:
|
||||||
data = sock.recv(1024).decode('utf-8')
|
data = sock.recv(1024).decode('utf-8')
|
||||||
role = data[1:5]
|
role = data[1:5]
|
||||||
|
problem = data.split(' ')[1]
|
||||||
#print("Role: ",role)
|
#print("Role: ",role)
|
||||||
if role == "prob":
|
if role == "prob":
|
||||||
draw.sendDraw(sock,userList,screen)
|
draw.sendDraw(sock,userList,screen,problem)
|
||||||
continueFlag = True
|
continueFlag = True
|
||||||
elif role == "gues":
|
elif role == "gues":
|
||||||
draw.receiveDraw(sock,screen)
|
draw.receiveDraw(sock,screen)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user