pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <small id='7lVXe'></small><noframes id='7lVXe'>

      <tfoot id='7lVXe'></tfoot>
      <legend id='7lVXe'><style id='7lVXe'><dir id='7lVXe'><q id='7lVXe'></q></dir></style></legend>
      • <bdo id='7lVXe'></bdo><ul id='7lVXe'></ul>

    1. <i id='7lVXe'><tr id='7lVXe'><dt id='7lVXe'><q id='7lVXe'><span id='7lVXe'><b id='7lVXe'><form id='7lVXe'><ins id='7lVXe'></ins><ul id='7lVXe'></ul><sub id='7lVXe'></sub></form><legend id='7lVXe'></legend><bdo id='7lVXe'><pre id='7lVXe'><center id='7lVXe'></center></pre></bdo></b><th id='7lVXe'></th></span></q></dt></tr></i><div class="qewy0co" id='7lVXe'><tfoot id='7lVXe'></tfoot><dl id='7lVXe'><fieldset id='7lVXe'></fieldset></dl></div>
    2. 如何使用 Kivy 制作工具提示?

      How to make ToolTip using Kivy?(如何使用 Kivy 制作工具提示?)
        • <i id='IcOhr'><tr id='IcOhr'><dt id='IcOhr'><q id='IcOhr'><span id='IcOhr'><b id='IcOhr'><form id='IcOhr'><ins id='IcOhr'></ins><ul id='IcOhr'></ul><sub id='IcOhr'></sub></form><legend id='IcOhr'></legend><bdo id='IcOhr'><pre id='IcOhr'><center id='IcOhr'></center></pre></bdo></b><th id='IcOhr'></th></span></q></dt></tr></i><div class="owk2msu" id='IcOhr'><tfoot id='IcOhr'></tfoot><dl id='IcOhr'><fieldset id='IcOhr'></fieldset></dl></div>

              <tbody id='IcOhr'></tbody>
            <tfoot id='IcOhr'></tfoot>

            <small id='IcOhr'></small><noframes id='IcOhr'>

              <bdo id='IcOhr'></bdo><ul id='IcOhr'></ul>
            • <legend id='IcOhr'><style id='IcOhr'><dir id='IcOhr'><q id='IcOhr'></q></dir></style></legend>
              • 本文介紹了如何使用 Kivy 制作工具提示?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                當鼠標指針懸停在 ActionBar 中的圖標上時,我希望在 Qt 中看到工具提示.
                是的,我可以使用 mode='spinner',但圖標更好.

                I want to see tooltip as in Qt when the mouse pointer is hovering over icon in ActionBar.
                Yes, I can use mode='spinner', but icons are nicer.

                推薦答案

                一個可以改進和擴展的簡單示例:

                A simple example you can improve and extend:

                from kivy.app import App
                from kivy.lang import Builder
                from kivy.uix.widget import Widget
                from kivy.core.window import Window
                from kivy.uix.actionbar import ActionButton
                from kivy.uix.label import Label
                from kivy.clock import Clock
                
                Builder.load_string("""
                <Tooltip>:
                    size_hint: None, None
                    size: self.texture_size[0]+5, self.texture_size[1]+5
                    canvas.before:
                        Color:
                            rgb: 0.2, 0.2, 0.2
                        Rectangle:
                            size: self.size
                            pos: self.pos
                
                <MyWidget>
                    ActionBar:
                        ActionView:
                            MyActionButton:
                                icon: 'atlas://data/images/defaulttheme/audio-volume-high'
                            MyActionButton:
                                icon: 'atlas://data/images/defaulttheme/audio-volume-high'                
                """)
                
                class Tooltip(Label):
                    pass
                
                class MyActionButton(ActionButton):
                    tooltip = Tooltip(text='Hello world')
                
                    def __init__(self, **kwargs):
                        Window.bind(mouse_pos=self.on_mouse_pos)
                        super(ActionButton, self).__init__(**kwargs)
                
                    def on_mouse_pos(self, *args):
                        if not self.get_root_window():
                            return
                        pos = args[1]
                        self.tooltip.pos = pos
                        Clock.unschedule(self.display_tooltip) # cancel scheduled event since I moved the cursor
                        self.close_tooltip() # close if it's opened
                        if self.collide_point(*self.to_widget(*pos)):
                            Clock.schedule_once(self.display_tooltip, 1)
                
                    def close_tooltip(self, *args):
                        Window.remove_widget(self.tooltip)
                
                    def display_tooltip(self, *args):
                        Window.add_widget(self.tooltip)
                
                
                class MyWidget(Widget):
                    pass
                
                class ClientApp(App):
                    def build(self):
                        return MyWidget()
                
                if __name__ == '__main__':
                    ClientApp().run()
                

                首先我將 on_mouse_pos 方法綁定到 Window.mouse_pos 事件,以便我可以檢測鼠標光標何時懸停在我的 ActionButton 子類上.這是基于這個片段.然后,如果我不移動光標,我會使用 Clock.schedule_once() 安排一個動作,以使我的工具箱可見.為了顯示,我只是將 Label 的子類添加到小部件堆棧中.您可以用更復雜的方法替換 display_tooltip()close_tooltip() 方法.

                First I bind on_mouse_pos method to Window.mouse_pos event so I can detect when the mouse cursor hovers over my subclass of ActionButton. This is based on this snippet. Then I shedule an action with Clock.schedule_once() to make my toolbox visible if I won't move my cursor. To display I'm just adding a subclass of Label to the stack of widgets. You can replace display_tooltip() and close_tooltip() methods with more sophisticated ones.

                將代碼相應地更新為 this answer

                這篇關于如何使用 Kivy 制作工具提示?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                message.channel.id Discord PY(message.channel.id Discord PY)
                How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                  <tbody id='JEKwc'></tbody>
                <i id='JEKwc'><tr id='JEKwc'><dt id='JEKwc'><q id='JEKwc'><span id='JEKwc'><b id='JEKwc'><form id='JEKwc'><ins id='JEKwc'></ins><ul id='JEKwc'></ul><sub id='JEKwc'></sub></form><legend id='JEKwc'></legend><bdo id='JEKwc'><pre id='JEKwc'><center id='JEKwc'></center></pre></bdo></b><th id='JEKwc'></th></span></q></dt></tr></i><div class="0owuwig" id='JEKwc'><tfoot id='JEKwc'></tfoot><dl id='JEKwc'><fieldset id='JEKwc'></fieldset></dl></div>

                  • <small id='JEKwc'></small><noframes id='JEKwc'>

                      <tfoot id='JEKwc'></tfoot>

                        <legend id='JEKwc'><style id='JEKwc'><dir id='JEKwc'><q id='JEKwc'></q></dir></style></legend>

                        • <bdo id='JEKwc'></bdo><ul id='JEKwc'></ul>
                        • 主站蜘蛛池模板: 湖州织里童装_女童男童中大童装_款式多尺码全_织里儿童网【官网】-嘉兴嘉乐网络科技有限公司 | 聚丙烯酰胺_阴离子_阳离子「用量少」巩义亿腾厂家直销,售后无忧 聚合甘油__盐城市飞龙油脂有限公司 | 电机修理_二手电机专家-河北豫通机电设备有限公司(原石家庄冀华高压电机维修中心) | 拉伸膜,PE缠绕膜,打包带,封箱胶带,包装膜厂家-东莞宏展包装 | 搪瓷反应釜厂家,淄博搪瓷反应釜-淄博卓耀 | 【北京写字楼出租_写字楼租赁_办公室出租网/出售】-远行地产官网 | 超声波清洗机-超声波清洗设备定制生产厂家 - 深圳市冠博科技实业有限公司 | ★塑料拖链__工程拖链__电缆拖链__钢制拖链 - 【上海闵彬】 | 香蕉筛|直线|等厚|弧形|振动筛|香蕉筛厂家-洛阳隆中重工 | 电动葫芦-河北悍象起重机械有限公司 | 不锈钢列管式冷凝器,换热器厂家-无锡飞尔诺环境工程有限公司 | 超声波乳化机-超声波分散机|仪-超声波萃取仪-超声波均质机-精浩机械|首页 | 门禁卡_智能IC卡_滴胶卡制作_硅胶腕带-卡立方rfid定制厂家 | 电竞馆加盟,沈阳网吧加盟费用选择嘉棋电竞_售后服务一体化 | 运动木地板厂家_体育木地板安装_篮球木地板选购_实木运动地板价格 | 钢板仓,大型钢板仓,钢板库,大型钢板库,粉煤灰钢板仓,螺旋钢板仓,螺旋卷板仓,骨料钢板仓 | 聚氨酯保温钢管_聚氨酯直埋保温管道_聚氨酯发泡保温管厂家-沧州万荣防腐保温管道有限公司 | 时代北利离心机,实验室离心机,医用离心机,低速离心机DT5-2,美国SKC采样泵-上海京工实业有限公司 工业电炉,台车式电炉_厂家-淄博申华工业电炉有限公司 | 河南生物显微镜,全自动冰冻切片机-河南荣程联合科技有限公司 | 打包箱房_集成房屋-山东佳一集成房屋有限公司 | 科威信洗净科技,碳氢清洗机,超声波清洗机,真空碳氢清洗机 | 猎头招聘_深圳猎头公司_知名猎头公司 | 扫地车厂家-山西洗地机-太原电动扫地车「大同朔州吕梁晋中忻州长治晋城洗地机」山西锦力环保科技有限公司 | 开平机_纵剪机厂家_开平机生产厂家|诚信互赢-泰安瑞烨精工机械制造有限公司 | 广州展台特装搭建商|特装展位设计搭建|展会特装搭建|特装展台制作设计|展览特装公司 | 干法制粒机_智能干法制粒机_张家港市开创机械制造有限公司 | 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 中药二氧化硫测定仪,食品二氧化硫测定仪|俊腾百科 | 厂房出租-厂房规划-食品技术-厂房设计-厂房装修-建筑施工-设备供应-设备求购-龙爪豆食品行业平台 | 单柱拉力机-橡胶冲片机-哑铃裁刀-江都轩宇试验机械厂 | 【德信自动化】点胶机_全自动点胶机_自动点胶机厂家_塑料热压机_自动螺丝机-深圳市德信自动化设备有限公司 | 石家庄网站建设|石家庄网站制作|石家庄小程序开发|石家庄微信开发|网站建设公司|网站制作公司|微信小程序开发|手机APP开发|软件开发 | 小型单室真空包装机,食品单室真空包装机-百科 | 列管冷凝器,刮板蒸发器,外盘管反应釜厂家-无锡曼旺化工设备有限公司 | 铸铁平台,大理石平台专业生产厂家_河北-北重机械 | 德州万泰装饰 - 万泰装饰装修设计软装家居馆 | 分子精馏/精馏设备生产厂家-分子蒸馏工艺实验-新诺舜尧(天津)化工设备有限公司 | RV减速机-蜗轮蜗杆减速机-洗车机减速机-减速机厂家-艾思捷 | 济宁工业提升门|济宁电动防火门|济宁快速堆积门-济宁市统一电动门有限公司 | 全钢实验台,实验室工作台厂家-无锡市辰之航装饰材料有限公司 | 食品无尘净化车间,食品罐装净化车间,净化车间配套风淋室-青岛旭恒洁净技术有限公司 |