本文整理汇总了Python中pyjamas.ui.HTML.HTML类的典型用法代码示例。如果您正苦于以下问题:Python HTML类的具体用法?Python HTML怎么用?Python HTML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: GettextExample
class GettextExample(object):
def __init__(self):
self.b = Button(_("Click me"), self.greet, StyleName='teststyle')
self.h = HTML(_("<b>Hello World</b> (html)"), StyleName='teststyle')
self.l = Label(_("Hello World (label)"), StyleName='teststyle')
self.base = HTML(_("Hello from %s") % pygwt.getModuleBaseURL(),
StyleName='teststyle')
RootPanel().add(self.b)
RootPanel().add(self.h)
RootPanel().add(self.l)
RootPanel().add(self.base)
def change_texts(self, text):
self.b.setText(_("Click me"))
self.h.setHTML(_("<b>Hello World</b> (html)"))
self.l.setText(_("Hello World (label)"))
text = [_("Hello from %s") % pygwt.getModuleBaseURL()]
for i in range(4):
text.append(ngettext('%(num)d single', '%(num)d plural', i) % dict(num=i))
text = '<br />'.join(text)
self.base.setHTML(text)
def greet(self, fred):
fred.setText(_("No, really click me!"))
Window.alert(_("Hello, there!"))
i18n.load(lang=lang[0], onCompletion=self.change_texts)
lang.append(lang.pop(0))
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:Gettext.py
示例2: YChanger
class YChanger (HorizontalPanel):
def __init__(self, chart):
self.chart = chart
HorizontalPanel.__init__(self)
# y-changing, x,y coordinate displaying, widget
self.incrementY = Button("Increment Y")
self.coordinates = HTML(""); # x,y of selected point
self.decrementY = Button("Decrement Y")
self.incrementY.addClickListener(self)
self.decrementY.addClickListener(self)
self.add(self.incrementY)
self.add(self.coordinates)
self.add(self.decrementY)
def onClick(self, sender):
if sender == self.incrementY:
self.chart.getTouchedPoint().setY(
self.chart.getTouchedPoint().getY() + 1)
else:
self.chart.getTouchedPoint().setY(
self.chart.getTouchedPoint().getY() - 1)
self.chart.update()
# The 2 HoverUpdateable interface methods:
def hoverCleanup(self, hoveredAwayFrom):
pass
def hoverUpdate(self, hoveredOver):
# update (x,y) display when they click point
self.coordinates.setHTML(hoveredOver.getHovertext())
开发者ID:Afey,项目名称:pyjs,代码行数:31,代码来源:GChartExample21.py
示例3: __init__
def __init__(self, grid_size):
Grid.__init__(self)
# populate the grid with some stuff
#
self.resize(grid_size, grid_size)
self.setBorderWidth(2)
self.setCellPadding(4)
self.setCellSpacing(1)
self.setStyleName("gameboard") # just doesn't work
# Set up game board
#
# Note that must iterate over indices, rather than Cell
# instances, until the table positions are set up here
#
index = 0 # debug
for i in range(grid_size):
for j in range(grid_size):
cell = HTML(SPACE)
# cell.setVisible(False) # causes to ignore click events
cell.position = (i, j) # might be handy at some point
index+=1; cell.index = index # debug
# cell.setStyleName("cell_O")
cell.addClickListener(getattr(self, "onCellClicked"))
self.setWidget(i, j, cell)
开发者ID:tmst,项目名称:Tic-Tac-Toe,代码行数:28,代码来源:tictactoe.py
示例4: addContact
def addContact(self, contact):
link = HTML("<a href='javascript:;'>" + contact.name + "</a>")
self.panel.add(link)
# Add a click listener that displays a ContactPopup when it is clicked.
listener = ContactListener(contact, link)
link.addClickListener(listener)
开发者ID:Ludovic-Condette,项目名称:pyjs,代码行数:7,代码来源:Contacts.py
示例5: DisplayPanel
class DisplayPanel(Composite):
def __init__(self, owner):
Composite.__init__(self)
self.owner = owner
self.bar = DockPanel()
self.timer_msg = HTML(" timer: ")
self.timer = TimeDisplay()
self.timer_panel = HorizontalPanel()
self.timer_panel.add(self.timer_msg)
self.timer_panel.add(self.timer)
self.counter_msg = HTML(" total moves: ")
self.counter = HTML("0")
self.counter_panel = HorizontalPanel()
self.counter_panel.add(self.counter_msg)
self.counter_panel.add(self.counter)
self.initWidget(self.bar)
self.bar.add(self.timer_panel, DockPanel.WEST)
self.bar.add(self.counter_panel, DockPanel.EAST)
self.setStyleName("Puzzle-DisplayPanel")
def incrCount(self):
count = self.counter.getText()
count = int(count) + 1
self.counter.setText(count)
def reset(self):
self.timer.setDisplay(0, 0, 0)
self.counter.setText("0")
开发者ID:vijayendra,项目名称:Puzzle-Game,代码行数:32,代码来源:Puzzle.py
示例6: __init__
def __init__(self):
Composite.__init__(self)
self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>")
self.aboutLink = HTML("<a href='javascript:;'>About</a>")
outer = HorizontalPanel()
inner = VerticalPanel()
outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
links = HorizontalPanel()
links.setSpacing(4)
links.add(self.signOutLink)
links.add(self.aboutLink)
outer.add(inner)
inner.add(HTML("<b>Welcome back, [email protected]</b>"))
inner.add(links)
self.signOutLink.addClickListener(self)
self.aboutLink.addClickListener(self)
self.initWidget(outer)
inner.setStyleName("mail-TopPanel")
links.setStyleName("mail-TopPanelLinks")
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:TopPanel.py
示例7: onModuleLoad
def onModuleLoad(self):
dock = DockPanel(Width="100%")
self.header = HTML(Width="100%", Height="220px")
self.footer = HTML(Width="100%")
self.sidebar = HTML(Width="200px", Height="100%", StyleName="sidebar")
self.fTabs = DecoratedTabPanel(Size=("100%", "100%"), StyleName="tabs")
#dp = DecoratorTitledPanel("Tabs", "bluetitle", "bluetitleicon",
# ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
#dp.add(self.fTabs)
dock.add(self.header, DockPanel.NORTH)
dock.add(self.footer, DockPanel.SOUTH)
dock.add(self.sidebar, DockPanel.EAST)
dock.add(self.fTabs, DockPanel.CENTER)
dock.setCellVerticalAlignment(self.fTabs, HasAlignment.ALIGN_TOP)
#dock.setCellHorizontalAlignment(self.fTabs, HasAlignment.ALIGN_CENTER)
dock.setCellWidth(self.header, "100%")
dock.setCellHeight(self.header, "220px")
dock.setCellWidth(self.footer, "100%")
dock.setCellWidth(self.sidebar, "200px")
RootPanel().add(dock)
self.dock = dock
self.loadPageList()
Window.addWindowResizeListener(self)
DeferredCommand.add(self)
开发者ID:brodybits,项目名称:pyjs.org,代码行数:31,代码来源:website.py
示例8: __init__
def __init__(self, userListPanel, tabPanel, topPanel):
VerticalPanel.__init__(self, StyleName='large-avatar-panel')
self.userListPanel = userListPanel
self.tabPanel = tabPanel
self.topPanel = topPanel
upperPanel = HorizontalPanel(StyleName='large-avatar-upper-panel',
Spacing=8)
self.image = Image(StyleName='large-avatar')
self.upperText = HTML(StyleName='large-avatar-upper-text')
upperPanel.add(self.image)
upperPanel.add(self.upperText)
self.add(upperPanel)
self.lowerText = HTML(StyleName='large-avatar-lower-text')
self.add(self.lowerText)
self.followButton = None
self.user = None
insertPanel = HorizontalPanel(Spacing=3)
insertPanel.add(Label('Use name: '))
if tabPanel.tabName == 'simple':
b1 = Button('upper', SimpleInserter(self, 'upper'))
b2 = Button('lower', SimpleInserter(self, 'lower'))
insertPanel.add(b1)
insertPanel.add(b2)
else:
b1 = Button('or', QueryInserter(self, 'or'))
b2 = Button('and', QueryInserter(self, 'and'))
b3 = Button('except', QueryInserter(self, 'except'))
insertPanel.add(b1)
insertPanel.add(b2)
insertPanel.add(b3)
self.add(insertPanel)
开发者ID:jdunck,项目名称:Tickery,代码行数:31,代码来源:userlist.py
示例9: __init__
def __init__(self, txt, **kwargs):
txt = HTML(txt)
txt.addClickListener(self)
PopupPanel.__init__(self, autoHide=True, StyleName="showcase-popup",
**kwargs)
self.add(txt)
self.show()
开发者ID:ncqgm,项目名称:gnumed,代码行数:8,代码来源:WebguiHelpers.py
示例10: __init__
def __init__(self):
PopupPanel.__init__(self, True)
contents = HTML("Click anywhere outside this popup to make it disappear.")
contents.setWidth("128px")
self.setWidget(contents)
self.setStyleName("ks-popups-Popup")
开发者ID:brodybits,项目名称:pyjs,代码行数:8,代码来源:Popups.py
示例11: __init__
def __init__(self, hrs=0, mins=0, secs=0):
self.isActive = False
self.hrs = hrs
self.mins = mins
self.secs = secs
HTML.__init__(self)
self.setDisplay(self.hrs, self.mins, self.secs)
self.onTimer()
开发者ID:vijayendra,项目名称:Puzzle-Game,代码行数:8,代码来源:Puzzle.py
示例12: onCompletion
def onCompletion(self, response):
'''This method is called when asyncGet returns. If we know parameters of the
repsponse we may process differently for various cases. For example we may setup
data in the form if we call it from Populate Form button.
'''
self.view.root.remove(self.view.panel)
html = HTML()
html.setHTML(response)
self.view.root.add(html)
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:9,代码来源:form.py
示例13: start
def start(sender):
Window.alert("Hello, GAMERS!")
hw = HTML("<img src='http://github.com/jrabbit/Defenditt/raw/master/public/media/instructions%20screen.png' alt='instructions'/>")
hw.setID('instructions')
RootPanel().add(hw)
JS("""
parent.top.document.getElementById("splash").style.display = "none";
parent.top.document.getElementById("startbutton").style.display = "none";
parent.top.document.getElementById("startbutton").style.height = 0;
""")
开发者ID:jrabbit,项目名称:Defenditt,代码行数:10,代码来源:pyhelloworld.py
示例14: __init__
def __init__(self, tags = None, width = 300, selected = None, myid = 'select2example'):
#log.info("tags='%s' width='%s' selected='%s'", tags, width, selected)
self.myid = myid
self.tags = tags
# This markup is used by select2 to configure the component
html = '<p><input type="hidden" id="%s" style="width:%dpx"/></p>' % (myid, width)
html += '<div id="%s-show"></div>' % (myid)
self.selected = selected
log.info("html = '%s'", html)
HTML.__init__(self, html)
开发者ID:gonvaled,项目名称:pyjs,代码行数:10,代码来源:Select2TaggingComponent.py
示例15: __init__
def __init__(self):
self.calsPanel = VerticalPanel(Size=("50%", ""))
self.info = HTML("", Width="100%")
self.calsPanel.add(self.info)
self.localcalreport = HTML("", True, )
self.globalcalreport = HTML("", True, )
self.calsPanel.add(self.localcalreport)
self.calsPanel.add(self.globalcalreport)
self.panel = self.calsPanel
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:10,代码来源:ADViewerIFACE.py
示例16: __init__
def __init__(self):
self.b = Button(_("Click me"), self.greet, StyleName='teststyle')
self.h = HTML(_("<b>Hello World</b> (html)"), StyleName='teststyle')
self.l = Label(_("Hello World (label)"), StyleName='teststyle')
self.base = HTML(_("Hello from %s") % pygwt.getModuleBaseURL(),
StyleName='teststyle')
RootPanel().add(self.b)
RootPanel().add(self.h)
RootPanel().add(self.l)
RootPanel().add(self.base)
开发者ID:Afey,项目名称:pyjs,代码行数:10,代码来源:Gettext.py
示例17: RightPanel
class RightPanel(DockPanel):
def __init__(self):
DockPanel.__init__(self)
self.grids = {}
self.g = Grid()
self.g.setCellSpacing("0px")
self.g.setCellPadding("8px")
self.title = HTML(" ")
self.title.setStyleName("rightpanel-title")
self.add(self.title, DockPanel.NORTH)
self.setCellWidth(self.title, "100%")
self.setCellHorizontalAlignment(self.title,
HasHorizontalAlignment.ALIGN_LEFT)
self.add(self.g, DockPanel.CENTER)
def setTitle(self, title):
self.title.setHTML(title)
def clear_items(self):
for i in range(len(self.grids)):
g = self.grids[i]
if hasattr(g, "clear_items"):
g.clear_items()
self.grids = {}
self.g.resize(0, 0)
def setup_panels(self, datasets):
self.grids = {}
self.data = {}
self.names = {}
self.loaded = {}
size = len(datasets)
self.g.resize(size, 1)
#for i in range(size):
# item = datasets[i]
# fname = item[0]
# self.grids[i] = RightGrid(fname)
# self.g.setWidget(i, 0, self.grids[i])
def add_html(self, html, name, index):
self.data[index] = html
self.names[index] = name
self.grids[index] = HTML(html)
self.g.setWidget(index, 0, self.grids[index])
def add_items(self, items, name, index):
self.data[index] = items
self.names[index] = name
self.grids[index] = RightGrid("")
self.grids[index].set_items(items)
self.g.setWidget(index, 0, self.grids[index])
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:55,代码来源:InfoDirectory.py
示例18: showPopup
def showPopup(self, event):
contents = HTML("Hello, World!")
contents.addClickListener(getattr(self, "onClick"))
self._popup = PopupPanel(autoHide=True)
self._popup.add(contents)
self._popup.setStyleName("showcase-popup")
left = self._btn.getAbsoluteLeft() + 10
top = self._btn.getAbsoluteTop() + 10
self._popup.setPopupPosition(left, top)
self._popup.show()
开发者ID:Afey,项目名称:pyjs,代码行数:12,代码来源:popupPanel.py
示例19: onModuleLoad
class Slideshow:
def onModuleLoad(self):
self.slide = HTML()
RootPanel().add(self.slide)
HTTPRequest().asyncPost("test_slide.txt", "", SlideLoader(self))
def setSlide(self, content):
self.slide.setHTML("<pre>%s</pre>" % content)
def onError(self, text, code):
self.slide.setHTML(text + "<br />" + code)
开发者ID:kurifu,项目名称:CMUSV-Voting,代码行数:13,代码来源:slideshow.py
示例20: CalibrateChannelTrimsView
class CalibrateChannelTrimsView(object) :
"""
Class that takes care of the purely UI parts of the trim calibration
"""
def __init__( self ) :
numberOfLoopsPanel=HorizontalPanel()
numberOfLoopsPanel.add( HTML("Maximum number of loops") )
self.maximumNumberOfLoops=TextBox()
self.maximumNumberOfLoops.setText(10)
numberOfLoopsPanel.add( self.maximumNumberOfLoops )
numberOfLoopsPanel.setCellHorizontalAlignment( self.maximumNumberOfLoops, HasHorizontalAlignment.ALIGN_RIGHT )
numberOfLoopsPanel.setWidth("100%")
aimPointPanel=HorizontalPanel()
aimPointPanel.add( HTML("Aim point") )
self.aimPoint=TextBox()
self.aimPoint.setText(127)
aimPointPanel.add( self.aimPoint )
aimPointPanel.setCellHorizontalAlignment( self.aimPoint, HasHorizontalAlignment.ALIGN_RIGHT )
aimPointPanel.setWidth("100%")
self.start=Button("Start")
self.echo=HTML("Initiating...")
self.mainPanel = VerticalPanel()
self.mainPanel.add( numberOfLoopsPanel )
self.mainPanel.add( aimPointPanel )
self.mainPanel.add( self.start )
self.mainPanel.add( self.echo )
def getMaxNumberOfLoops( self ) :
return int(self.maximumNumberOfLoops.getText())
def getAimPoint( self ) :
return int(self.aimPoint.getText())
def getStartButton( self ) :
return self.start
def setEchoText( self, text ) :
self.echo.setText( text )
def enable( self ) :
self.start.setEnabled(True)
def disable( self ) :
self.start.setEnabled(False)
def getPanel( self ) :
return self.mainPanel
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:51,代码来源:CalibrateChannelTrimsPanel.py
注:本文中的pyjamas.ui.HTML.HTML类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论