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


Python Image.addMouseListener方法代码示例

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


在下文中一共展示了Image.addMouseListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onRemoteResponse

# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
 def onRemoteResponse(self, result, request_info):
     if result['result']:
         self.sender.screenname = screenname = result['screen_name']
         h = HTML('%s ' % utils.screennameToTwitterLink(screenname),
                  StyleName='logged-in-text')
         self.sender.setWidget(0, 0, h)
         logout = Image('logout.gif', StyleName='logout-image')
         logout.addMouseListener(self)
         self.sender.setWidget(0, 1, logout)
         remote = server.TickeryService()
         id = remote.friendsIds(self.sender.oauthCookie,
             screenname, SetFriends(screenname, self.sender))
         if id < 0:
             self.sender.setWidget(
                 0, 1, Label("Oops: Couldn't fetch friends."))
     else:
         self.sender.notLoggedIn()
开发者ID:fluidinfo,项目名称:Tickery,代码行数:19,代码来源:login.py

示例2: notLoggedIn

# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
 def notLoggedIn(self):
     if self.oauthCookie:
         _deleteCookie()
         self.oauthCookie = None
     self.clear()
     self.loggedIn = False
     self.screenname = None
     self.friendsIds = None
     loginImage = Image('login.png', StyleName='login-image')
     loginImage.addMouseListener(self)
     self.setWidget(0, 0, loginImage)
     why = Button(WHY_BUTTON_TEXT, self, StyleName='why-button')
     self.setWidget(0, 1, why)
     self.instructions = HTML(WHY_TEXT,
                              StyleName='instructions-popup',
                              HorizontalAlignment=HasAlignment.ALIGN_LEFT)
     self.popup = tickerytab.InstructionBox(
         self.__class__.__name__, self.instructions)
     self.popup.setText(WHY_TITLE)
开发者ID:fluidinfo,项目名称:Tickery,代码行数:21,代码来源:login.py

示例3: __init__

# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
    def __init__(self):
        Sink.__init__(self)
        img = Image("images/num1.png")
        img.addMouseListener(TooltipListener("An image: " + img.getUrl()))
        
        img2 = Image("images/num2.png")
        img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))

        html = HTML("Some <i>HTML</i> text.")
        html.addMouseListener(TooltipListener("An HTML component."))
        
        panel_h = HorizontalPanel()
        panel_h.add(img)
        panel_h.add(img2)       
        panel_h.setSpacing(8)
        
        panel = VerticalPanel()
        panel.add(panel_h)
        panel.add(html)
        
        panel.setSpacing(8)
        self.setWidget(panel)
开发者ID:brodybits,项目名称:pyjs,代码行数:24,代码来源:TooltipTab.py

示例4: ControlButton

# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
class ControlButton(Composite):
    def __init__(self, up_url, down_url, up_msg, down_msg):
        Composite.__init__(self)
        self.state = "up"
        self.up_url = up_url
        self.down_url = down_url
        self.up_msg = up_msg
        self.down_msg = down_msg
        self.control = VerticalPanel()
        self.image = Image(up_url)
        self.image.setStyleName("gwt-Image-Cell")
        self.text = HTML(up_msg)
        self.image.base = self
        self.text.base = self
        self.text.horzAlign = "center"
        self.control.add(self.image)
        self.control.add(self.text)
        self.initWidget(self.control)

    def toggleImage(self):
        if self.state == "up":
            new_url = self.down_url
            new_msg = self.down_msg
            self.state = "down"
        elif self.state == "down":
            new_url = self.up_url
            new_msg = self.up_msg
            self.state = "up"

        self.image.setUrl(new_url)
        self.text.setHTML(new_msg)

    def toggleTimer(self):
        self.base.base.display_panel.timer.toggle()

    def addMouseListener(self, listner):
        self.image.addMouseListener(listner)
开发者ID:vijayendra,项目名称:Puzzle-Game,代码行数:39,代码来源:Puzzle.py

示例5: setUsers

# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
    def setUsers(self, title, users, kwargs):
        self.users = users
        self.nUsers = len(users)
        self.title = title
        self.resultPanel = HorizontalPanel(StyleName='result-panel')
        self.add(self.resultPanel)
        self.leftPanel = VerticalPanel(StyleName='results-left-panel',
                                       Width=self.leftPanelWidth)
        self.resultPanel.add(self.leftPanel)
        if not users:
            self.iconPanel = None
            self.leftPanel.add(HTML(title, StyleName='result-title'))
        else:
            # Set a display order that will show everything for now.
            self.displayOrder = range(self.nUsers)
            self.largeAvatar = LargeAvatar(self, self.tabPanel, self.topPanel)
            self.leftPanel.add(self.largeAvatar)

            resultPanelBottomLeft = VerticalPanel(
                StyleName='results-left-panel-bottom-left')

            self.resultLink = HTML(StyleName='result-detail')
            self.updateResultLink()
            resultPanelBottomLeft.add(self.resultLink)
            
            self.iconSizePanel = HorizontalPanel()
            self.iconSizePanel.add(
                HTML('Icons:&nbsp;', StyleName='result-detail'))

            self.iconSizeLb = lb = ListBox()
            i = 0
            for text, key in _iconData:
                lb.addItem(text, key)
                if key == _iconSize:
                    lb.setSelectedIndex(i)
                i += 1
            lb.addChangeListener(IconSizeChanger(self))
            self.iconSizePanel.add(lb)
            resultPanelBottomLeft.add(self.iconSizePanel)

            if self.nUsers > 1:
                self.sortPanel = HorizontalPanel()
                self.sortPanel.add(
                    HTML('Sort:&nbsp;', StyleName='result-detail'))

                self.lb = lb = ListBox()
                i = 0
                for text, key in _sortKeyData:
                    lb.addItem(text, key)
                    if key == _sortKey:
                        lb.setSelectedIndex(i)
                    i += 1
                lb.addChangeListener(self)
                self.sortPanel.add(lb)
                resultPanelBottomLeft.add(self.sortPanel)
                
            self.filterPanel = HorizontalPanel()
            resultPanelBottomLeft.add(self.filterPanel)
            self.addFilterWidgets()
            
            if self.topPanel.loggedIn():
                if 'screennames' in kwargs:
                    resultPanelBottomLeft.add(tweet.SimpleTweetPanel(
                        kwargs['screennames'], len(self.users), self.topPanel))
                elif 'query' in kwargs:
                    resultPanelBottomLeft.add(tweet.PrepareTweetButton(
                        kwargs['query'], len(self.users),
                        self.tabPanel.tabName, self.topPanel))

            self.leftPanel.add(resultPanelBottomLeft)

            self.iconPanel = VerticalPanel(StyleName='icon-outer-panel')
            self.resultPanel.add(self.iconPanel)
            self.images = []
            for u in users:
                url = u['profile_image_url']
                i = Image(url, StyleName='avatar-' + _iconSize)
                # Does calling prefetch actually help?
                i.prefetch(url)
                i._user = u
                i._selected = False
                i.addMouseListener(self)
                self.images.append(i)
            self.showUsers()
开发者ID:jdunck,项目名称:Tickery,代码行数:86,代码来源:userlist.py


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