本文整理汇总了Python中pyjamas.Window.prompt方法的典型用法代码示例。如果您正苦于以下问题:Python Window.prompt方法的具体用法?Python Window.prompt怎么用?Python Window.prompt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.Window
的用法示例。
在下文中一共展示了Window.prompt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onClick
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import prompt [as 别名]
def onClick(self, sender):
if sender == self.bold:
self.basic.toggleBold()
elif sender == self.italic:
self.basic.toggleItalic()
elif sender == self.underline:
self.basic.toggleUnderline()
elif sender == self.subscript:
self.basic.toggleSubscript()
elif sender == self.superscript:
self.basic.toggleSuperscript()
elif sender == self.strikethrough:
self.extended.toggleStrikethrough()
elif sender == self.indent:
self.extended.rightIndent()
elif sender == self.outdent:
self.extended.leftIndent()
elif sender == self.justifyLeft:
self.basic.setJustification(RichTextAreaConsts.LEFT)
elif sender == self.justifyCenter:
self.basic.setJustification(RichTextAreaConsts.CENTER)
elif sender == self.justifyRight:
self.basic.setJustification(RichTextAreaConsts.RIGHT)
elif sender == self.insertImage:
url = Window.prompt("Enter an image URL:", "http:#")
if url is not None:
self.extended.insertImage(url)
elif sender == self.createLink:
EventLinkPopup_open(self)
elif sender == self.removeLink:
self.extended.removeLink()
elif sender == self.hr:
self.extended.insertHorizontalRule()
elif sender == self.ol:
self.extended.insertOrderedList()
elif sender == self.ul:
self.extended.insertUnorderedList()
elif sender == self.removeFormat:
self.extended.removeFormat()
elif sender == self.richText:
# We use the RichTextArea's onKeyUp event to update the
# toolbar status. This will catch any cases where the
# user moves the cursor using the keyboard, or uses one of
# the browser's built-in keyboard shortcuts.
self.updateStatus()
self.checkForChange()
示例2: check_win
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import prompt [as 别名]
def check_win(self):
if not self.started:
return
if self.count_opened_cells == self.no_of_safe_zones:
for one in self.bombed_cells:
if one.state != 1:
one.setStyleName('cell bombflagged')
self.flagged_cells.append(one)
self.started = False
self.set_counter()
self.face.setStyleName('facewin')
name = Window.prompt("You've done it !\n\
Game Time: %s seconds\n\
Number of Clicks: %s\n"
"What's ur name ?" % (self.time, self.no_of_click))
if name and self.level in (1, 2, 3):
self.remote.add_score(name, self.level, self.time, \
self.no_of_click, self.remote_handler)
self.add_player_to_toppers(name)