当前位置: 首页>>代码示例>>Python>>正文


Python HTML.HTML类代码示例

本文整理汇总了Python中pyjamas.ui.HTML.HTML的典型用法代码示例。如果您正苦于以下问题:Python HTML类的具体用法?Python HTML怎么用?Python HTML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HTML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timer:&nbsp;")
        self.timer = TimeDisplay()
        self.timer_panel = HorizontalPanel()
        self.timer_panel.add(self.timer_msg)
        self.timer_panel.add(self.timer)
        
        self.counter_msg = HTML("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;total moves:&nbsp;")
        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


注:本文中的pyjamas.ui.HTML.HTML类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。