本文整理汇总了Python中pyjamas.ui.Button.Button.setID方法的典型用法代码示例。如果您正苦于以下问题:Python Button.setID方法的具体用法?Python Button.setID怎么用?Python Button.setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Button.Button
的用法示例。
在下文中一共展示了Button.setID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: htmlElements
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
def htmlElements(self, addList = None):
if not self._htmlElements:
h = HTML("<h1>Run data</h1>", StyleName='font-s07em')
p = HTML('<p>Enter <em>weighed</em> data to get information, through the neural network...</p>')
b=Button('addField', self, StyleName='link')
b.setID(ADD_FIELD_BUTTON)
f = FormPanel()
_f = self.fieldPanel([self.getWidgetObj(),0,0])
f.add(_f)
"""
t = TextArea(StyleName='page-textarea')
s=Button('submit', self, StyleName='link')
s.setID('submitButton')
"""
self._htmlElements = [['h', h], ['p', p], ['b', b], ['f', f]]
for i in range(len(self._htmlElements)):
RootPanel().add(self._htmlElements[i][1])
if addList:
self._htmlElements+=addList
for i in range(len(self._htmlElements)):
RootPanel().add(addList[i][1])
return self._htmlElements
示例2: themesPanel
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
def themesPanel(self, themes=None):
Window.alert('line:111')
themes = None
if not themes: themes=['0','1', 'cms', 'pypress']
vPanel = VerticalPanel()
for i in range(len(themes)):
"""
a_n = location.getPathName().split('/')[1]
lambda1 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/'+x+'/')+'?theme='+x
lambda2 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/a/')+'?theme='+x
href = {
'cms' : lambda1,
'pypress' : lambda1,
'o' : lambda2,
'1' : lambda2
}.get(themes[i], lambda2)(themes[i])
"""
a=Button('theme '+themes[i],
lambda x: location.setSearchDict({'theme': x.getID()}),
StyleName='link')
a.setID(themes[i])
vPanel.add(a)
return vPanel
示例3: themesPanel
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
def themesPanel(self, themes=None):
themes = None
if not themes: themes=['0','1', 'cms', 'pypress']
vPanel = VerticalPanel()
vPanel.setID('themes')
for i in range(len(themes)):
a=Button('theme %s' % themes[i], Index.toTheme, StyleName='link')
a.setID(themes[i])
vPanel.add(a)
return vPanel
示例4: themesPanel
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
def themesPanel(self, themes=None):
themes = None
if not themes: themes=['0','1', 'cms', 'pypress']
vPanel = VerticalPanel()
for i in range(len(themes)):
a=Button('theme '+themes[i],
lambda x: location.setSearchDict({'theme': x.getID()}),
StyleName='link')
a.setID(themes[i])
vPanel.add(a)
return vPanel
示例5: htmlElements
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
def htmlElements(self, addList = None):
if not self._htmlElements:
h = HTML("<h1>Hello from %s</h1>" % location.getHref(), StyleName='font-s07em')
p = HTML('<p>Enter vaild CreationTimeFrame code and submit...</p>')
m = HorizontalPanel()
t = TextArea(StyleName='page-textarea')
b=Button('submit', self, StyleName='link')
b.setID('submitButton')
self._htmlElements = [['h', h], ['p', p], ['m', m], ['t', t], ['b', b]]
for i in range(len(self._htmlElements)):
RootPanel().add(self._htmlElements[i][1])
if addList:
self._htmlElements+=addList
for i in range(len(self._htmlElements)):
RootPanel().add(addList[i][1])
return self._htmlElements
示例6: HomePanel
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
class HomePanel(AbsolutePanel):
def __init__(self, parent):
AbsolutePanel.__init__(self)
self.home_header = Label("Blogjamas", StyleName="header_label")
self.write_button = Button("Write a Post")
self.edit_hidden_button = Button("", StyleName="hidden_button")
self.delete_hidden_button = Button("", StyleName="hidden_button")
self.add(self.home_header)
self.add(self.write_button)
self.add(self.edit_hidden_button)
self.add(self.delete_hidden_button)
def update_posts(self, posts):
self.contents = VerticalPanel(Spacing=1)
for i in range(len(posts)):
self.divider = HTML("----------------------------------------------------")
self.contents.add(self.divider)
self.post_title = Label(posts[i].title, StyleName="title_label")
self.contents.add(self.post_title)
self.post_content = Label(posts[i].content, StyleName="content_label")
self.contents.add(self.post_content)
self.edit_button = Button("Edit")
self.edit_button.setID("edit_" + posts[i].post_id)
self.edit_button.addClickListener(self.show_edit_box)
self.contents.add(self.edit_button)
self.delete_button = Button("Delete")
self.delete_button.setID("delete_" + posts[i].post_id)
self.delete_button.addClickListener(self.delete_post)
self.contents.add(self.delete_button)
self.add(self.contents)
def show_edit_box(self, sender):
self.edit_hidden_button.setID(sender.getID())
self.edit_hidden_button.click(self)
def delete_post(self, sender):
self.delete_hidden_button.setID(sender.getID())
self.delete_hidden_button.click(self)
示例7: defenditt
# 需要导入模块: from pyjamas.ui.Button import Button [as 别名]
# 或者: from pyjamas.ui.Button.Button import setID [as 别名]
""")
def defenditt():
#Characters
snoo = Image("./public/media/reddit alien.png")
suit = Image("./public/media/suit.png")
bullet = Image("./public/media/bullet.png")
suit()
pass
def suit():
"""spawn a zombie marketer at a random Y at the far right"""
# 300, random.randrange(0,250)
class OurCanvas(Canvas):
def __init__(self):
Canvas.__init__(self, 300, 250)
self.img = CanvasImage('media/splash screen.png', self)
self.draw()
if __name__ == '__main__':
#Canvas.__init__(0,0)
b = Button("Start Game", start)
b.setID('startbutton')
RootPanel().add(b)
hw = HTML("<img src='http://github.com/jrabbit/Defenditt/raw/master/public/media/splash%20screen.png' alt='start screen'/>")
hw.setID("splash")
RootPanel().add(hw)