def edit_task(self, ev, task): ev.stopPropagation() ret = prompt("Task", task.desc) if ret: task.desc = ret self.set_text(task)
def base64_compute(_) -> None: default = "Real Python" data = prompt("Enter a string:", default) data = data or default b64data = base64.b64encode(data.encode()).decode() b64_map[data] = b64data display_map()
def add_task(self, ev, step, node): ev.stopPropagation() t = time.strftime(TIME_FMT) desc = prompt("New task", "%s %s" % (step.desc, t)) if desc: task = self.kanban.add_task(step.id, desc, 0, 0) self.draw_task(task, node)
def add_task(self, ev, step, node): ev.stopPropagation() t = time.strftime(TIME_FMT) desc = prompt("New task", f"{step.desc} {t}") if desc: task = self.kanban.add_task(step.id, desc, 0, 0) self.draw_task(task, node)
def raw_input(prompt="Enter a value"): result = browser.prompt(prompt) writeToConsole("%s --> %s" % (prompt, result), "blue") return result
def raw_input(prompt="Enter a value"): return browser.prompt(prompt)
def hello(evt): default = "Real Python" name = prompt("Enter your name:", default) if not name: name = default document["hello"].innerHTML = f"Hello, {name}!"
def save_as(evt, elt): global current name = prompt("Name") if name: _save(name)
def save_as(evt, elt): """Save current script with a new name.""" name = prompt("Name") if name: _save(name)
def on_open(evt): ws.send(f'{user} Entrouuuu na salala') @bind('#send', 'click') def on_enviar(evt): message = document["text_message"].value if len(message) > 1 or "\n" not in message: ws.send(f'{user} disse: {message}') document["text_message"].value = "" else: document["text_message"].value = "" @bind('#text_message', 'keydown') def on_lala(evt): if evt.which == 13: on_enviar(evt) user = prompt('Digite seu nome para o chat') if window.location.protocol == "https:": ws_scheme = "wss://" else: ws_scheme = "ws://" ws = websocket.WebSocket(f'{ws_scheme}{window.location.host}/ws/duplex/{user}') ws.bind('message', on_message) ws.bind('open', on_open)
from browser import prompt, websocket, window, document, html, bind name = prompt('Enter your name ') ws = websocket.WebSocket(f'ws://{window.location.host}/ws/full-duplex/{name}') @bind('#send', 'click') def send(event): ws.send(f'{name} disse: {document["text"].value}') document["text"].value = '' def on_open(event): ws.send(f'{name}, Entrou na sala.') def on_message(event): messages = document['messages'] messages <= html.P(event.data) messages.scrollTop = messages.scrollHeight - messages.clientHeight ws.bind('open', on_open) ws.bind('message', on_message)