本文整理匯總了Python中pyjamas.ui.Hyperlink.Hyperlink.setID方法的典型用法代碼示例。如果您正苦於以下問題:Python Hyperlink.setID方法的具體用法?Python Hyperlink.setID怎麽用?Python Hyperlink.setID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyjamas.ui.Hyperlink.Hyperlink
的用法示例。
在下文中一共展示了Hyperlink.setID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: onClick
# 需要導入模塊: from pyjamas.ui.Hyperlink import Hyperlink [as 別名]
# 或者: from pyjamas.ui.Hyperlink.Hyperlink import setID [as 別名]
def onClick(sender):
Window.alert('Make service request using %s'%sender.getID())
if __name__ == '__main__':
pyjd.setup("public/Anchor.html")
# EXAMPLE 1
a1 = Anchor(Widget = HTML('Test 1: Anchor to external site using HTML widget.'), Href='http://pyjs.org', Title = 'Test1')
RootPanel().add(a1)
# EXAMPLE 2
label = Label(text = 'Test 2: Click listener added to a label.')
label.addClickListener(onClick)
RootPanel().add(label)
# EXAMPLE 3
a2 = Hyperlink(text = 'Hyperlink', Element = DOM.createSpan())
a2.setID('param1')
a2.addClickListener(onClick)
html2=HTMLPanel("Test 3: <span id ='t3'></span> added to HTMLPanel with click listener.")
html2.add(a2, "t3")
RootPanel().add(html2)
# EXAMPLE 4
hpanel = HorizontalPanel()
hpanel.append(HTML('Test 4: Anchor to external site using Image widget'))
a3 = Anchor(Widget = Image('http://pyjs.org/assets/images/pyjs.128x128.png'), Href='http://pyjs.org', Title = 'Test4')
hpanel.append(a3)
RootPanel().add(hpanel)
# EXAMPLE 5
serverXml = \
"""
<html>
<head>