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

    <bdo id='7w4AY'></bdo><ul id='7w4AY'></ul>
  • <tfoot id='7w4AY'></tfoot>

      <i id='7w4AY'><tr id='7w4AY'><dt id='7w4AY'><q id='7w4AY'><span id='7w4AY'><b id='7w4AY'><form id='7w4AY'><ins id='7w4AY'></ins><ul id='7w4AY'></ul><sub id='7w4AY'></sub></form><legend id='7w4AY'></legend><bdo id='7w4AY'><pre id='7w4AY'><center id='7w4AY'></center></pre></bdo></b><th id='7w4AY'></th></span></q></dt></tr></i><div id='7w4AY'><tfoot id='7w4AY'></tfoot><dl id='7w4AY'><fieldset id='7w4AY'></fieldset></dl></div>

      1. <legend id='7w4AY'><style id='7w4AY'><dir id='7w4AY'><q id='7w4AY'></q></dir></style></legend>

        Kivy 窗口隐藏/显示

        Kivy window hide/show(Kivy 窗口隐藏/显示)
        1. <tfoot id='HrPDu'></tfoot>

              <bdo id='HrPDu'></bdo><ul id='HrPDu'></ul>

              <i id='HrPDu'><tr id='HrPDu'><dt id='HrPDu'><q id='HrPDu'><span id='HrPDu'><b id='HrPDu'><form id='HrPDu'><ins id='HrPDu'></ins><ul id='HrPDu'></ul><sub id='HrPDu'></sub></form><legend id='HrPDu'></legend><bdo id='HrPDu'><pre id='HrPDu'><center id='HrPDu'></center></pre></bdo></b><th id='HrPDu'></th></span></q></dt></tr></i><div id='HrPDu'><tfoot id='HrPDu'></tfoot><dl id='HrPDu'><fieldset id='HrPDu'></fieldset></dl></div>
                <tbody id='HrPDu'></tbody>
                <legend id='HrPDu'><style id='HrPDu'><dir id='HrPDu'><q id='HrPDu'></q></dir></style></legend>

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

                  本文介绍了Kivy 窗口隐藏/显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 python 编程和技巧的新手,学习让我创建一个项目.这就是我想要做的.我想创建一个在系统托盘中运行的程序并启动一个在后台加载的程序.在后台加载,这样我可以减少 Kivy 的启动时间.在这里和谷歌上搜索后,我找不到答案.

                  I'm a newby with python programming and tought, to learn let me create a project. Here is what i'm trying to do. I want to create a program that runs in system tray and fire's a program that is loaded in the background. Loaded in the background so I can reduce the start time of Kivy. After searching here and on google, i could not find the answer.

                  我有两个文件

                  from kivy.app import App
                  from kivy.uix.button import Button
                  from kivy.uix.label import Label
                  from kivy.uix.boxlayout import BoxLayout
                  from kivy.config import Config
                  from kivy.uix.screenmanager import ScreenManager, Screen
                  from kivy.core.window import Window
                  from kivy.config import Config
                  # 
                  
                  import kivy
                  from kivy.app import App
                  from kivy.uix.button import Button
                  from kivy.core.window import Window
                  
                  Config.set('graphics', 'window_state', 'hidden')
                  
                  class MyApp(App):
                      visible = False
                  
                      def build(self):
                          Window.bordeless = 'True'
                          return Button(text='Hello World')
                  
                      def on_start(self):
                          if self.visible:
                              self.root_window.hide()
                          self.visible = not self.visible
                          # self.root.focus = True
                  
                      def do_show(self):
                          rootWindow = self.root_window
                          rootWindow.show()
                          print(self.root_window.focus)
                  
                  if __name__ in ('__main__'):
                      ma = MyApp().run()
                  

                  import wx
                  import someKivyThigy
                  from kivy.app import App
                  from someKivyThigy import MyApp
                  from buttonThing import MyDebugApp
                  from kivy.core.window import Window
                  
                  TRAY_TOOLTIP = 'System Tray Demo'
                  TRAY_ICON = 'icon.png'
                  
                  testVar = MyApp
                  
                  def create_menu_item(menu, label, func):
                      item = wx.MenuItem(menu, -1, label)
                      menu.Bind(wx.EVT_MENU, func, id=item.GetId())
                      menu.AppendItem(item)
                      return item
                  
                  
                  class TaskBarIcon(wx.TaskBarIcon):
                      def __init__(self):
                          super(TaskBarIcon, self).__init__()
                          self.set_icon(TRAY_ICON)
                          self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
                  
                      def CreatePopupMenu(self):
                          menu = wx.Menu()
                          create_menu_item(menu, 'Say Hello', self.on_hello)
                          menu.AppendSeparator()
                          create_menu_item(menu, 'Exit', self.on_exit)
                          return menu
                  
                      def set_icon(self, path):
                          icon = wx.IconFromBitmap(wx.Bitmap(path))
                          self.SetIcon(icon, TRAY_TOOLTIP)
                  
                      def on_left_down(self, event):
                          print 'Tray icon was left-clicked.'
                          MyApp().do_show()
                  
                  
                      def on_hello(self, event):
                          print 'Hello, world!'
                  
                      def on_exit(self, event):
                          wx.CallAfter(self.Destroy)
                  
                  
                  def main():
                      app = wx.PySimpleApp()
                      TaskBarIcon()
                      testVar = MyApp().run()
                      app.MainLoop()
                  
                  if __name__ == '__main__':
                      main()
                  

                  当我左键单击系统托盘图标时,我收到错误消息:AttributeError: 'NoneType' object has no attribute 'show'".我做错了什么?

                  When i left click the system tray icon, i get the error: "AttributeError: 'NoneType' object has no attribute 'show'". What am I doing wrong?

                  推荐答案

                  Kivy 是专门为Android 平台制作的,但这并不意味着它不能用于桌面应用程序开发.但请记住,窗口管理器将 SLD2 提供程序保持为支持状态,因此此提供程序支持隐藏窗口但无法恢复它.

                  Kivy was made specially for Android Platform but it does not mean that it can't be used for desktop application development. But keep in mind that Window manager works with keeping SLD2 provider as backened so, this provider supports hide the window but cannot restore it.

                  对于隐藏窗口,您可以使用:Window.hide() after importing Window from kivy.core.window

                  For hiding window you can use : Window.hide() after importing Window from kivy.core.window

                  对于恢复,您可以使用:Window.restore() 或 Window.show()

                  And for restoring you can use: Window.restore() or Window.show()

                  这篇关于Kivy 窗口隐藏/显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                  Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                  How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                  Centering an object in Kivy(在 Kivy 中将对象居中)
                  How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                  Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)
                      • <bdo id='JTLnt'></bdo><ul id='JTLnt'></ul>

                            <tbody id='JTLnt'></tbody>

                          <legend id='JTLnt'><style id='JTLnt'><dir id='JTLnt'><q id='JTLnt'></q></dir></style></legend>
                          <tfoot id='JTLnt'></tfoot>

                            <i id='JTLnt'><tr id='JTLnt'><dt id='JTLnt'><q id='JTLnt'><span id='JTLnt'><b id='JTLnt'><form id='JTLnt'><ins id='JTLnt'></ins><ul id='JTLnt'></ul><sub id='JTLnt'></sub></form><legend id='JTLnt'></legend><bdo id='JTLnt'><pre id='JTLnt'><center id='JTLnt'></center></pre></bdo></b><th id='JTLnt'></th></span></q></dt></tr></i><div id='JTLnt'><tfoot id='JTLnt'></tfoot><dl id='JTLnt'><fieldset id='JTLnt'></fieldset></dl></div>

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