class ScrolledWB: VIEWPORT_WIDTH = 700 # Porción del canvas visible VIEWPORT_HEIGHT = 500 def __init__(self, wbWidth=400, wbHeight=400, cliente=None): self.frame = Frame(width=self.VIEWPORT_WIDTH, height=self.VIEWPORT_HEIGHT, bg="#c098af") self.wb = WhiteBoard(self.frame, width=self.VIEWPORT_WIDTH, height=self.VIEWPORT_HEIGHT, cliente=cliente) self.tbar = WBToolbar(self.wb.changeTool, self.wb.changeColor, self.wb.changeWidth, self.wb.imgs, self.wb.putImg) self.chat = ChatBox(cliente=cliente) self.vscroll = Scrollbar(self.frame, orient=VERTICAL, command=self.wb.yview) self.hscroll = Scrollbar(self.frame, orient=HORIZONTAL, command=self.wb.xview) self.wb.config(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.wb.config(scrollregion=(0,0,wbWidth,wbHeight)) #limitar scroll self.wb.maxWidth = wbWidth self.wb.maxHeight = wbHeight def focus_set(self): #self.wb.focus_set() pass def pack(self): self.tbar.pack(side=LEFT) self.hscroll.pack(side=BOTTOM, fill=X) self.chat.pack(side=BOTTOM, fill=X) self.vscroll.pack(side=RIGHT, fill=Y) self.wb.pack(fill=BOTH, expand=1) self.frame.pack(side=LEFT, fill=BOTH, expand=YES)
def __init__(self, wbWidth=400, wbHeight=400, cliente=None): self.frame = Frame(width=self.VIEWPORT_WIDTH, height=self.VIEWPORT_HEIGHT, bg="#c098af") self.wb = WhiteBoard(self.frame, width=self.VIEWPORT_WIDTH, height=self.VIEWPORT_HEIGHT, cliente=cliente) self.tbar = WBToolbar(self.wb.changeTool, self.wb.changeColor, self.wb.changeWidth, self.wb.imgs, self.wb.putImg) self.chat = ChatBox(cliente=cliente) self.vscroll = Scrollbar(self.frame, orient=VERTICAL, command=self.wb.yview) self.hscroll = Scrollbar(self.frame, orient=HORIZONTAL, command=self.wb.xview) self.wb.config(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.wb.config(scrollregion=(0,0,wbWidth,wbHeight)) #limitar scroll self.wb.maxWidth = wbWidth self.wb.maxHeight = wbHeight
grid = Grid() grid.draw_grid(screen) # Inicilizando e desenhando o botão de passar a vez. pass_turn_button = Button("Passar a vez", u.WHITE, u.BLUE) pass_turn_button.draw_button(screen, 150, 450, 200, 50) # Inicializando e desenhando o botão de desistir. give_up_button = Button("Desistir", u.WHITE, u.RED) give_up_button.draw_button(screen, 150, 525, 200, 50) # Inicializando o ChatBox chat_box = ChatBox(screen, 500, 80, 600, 350, u.WHITE) # Inicilizando o input_text input_text = InputText(screen, 500, 460, 400, 110, u.WHITE, "") # Inicializando o botão de enviar mensagem no chat send_mensage_button = Button("Enviar", u.WHITE, u.GREEN) send_mensage_button_rect = send_mensage_button.draw_button( screen, 920, 490, 200, 50) input_para_chatbox = ""