码迷,mamicode.com
首页 > 其他好文 > 详细

Kivy Event 在哪里?

时间:2020-02-02 01:23:35      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:which   gen   The   rom   调试   and   uri   handlers   rod   

kivy 程序都是都需要继承APP基类

而App类在Lib\site-packages\kivy\app.py文件定义

from kivy.event import EventDispatcher

class App(EventDispatcher):
  pass

找到Lib\site-packages\kivy\event.py 里面是这样定义的

import kivy._event
__doc__ = kivy._event.__doc__
EventDispatcher = kivy._event.EventDispatcher
ObjectWithUid = kivy._event.ObjectWithUid
Observable = kivy._event.Observable

又引用了Lib\site-packages\kivy_event.pxd , 而pxd文件只是个类似c里的头文件(接口声明), 真正的代码实现在
Lib\site-packages\kivy_event.cp36-win32.pyd (pxd描述参考)[https://cloud.tencent.com/developer/news/180987]

那为什么在pycharm 里查看时定义处时为什么会跳转到.PyCharm2018.3\system\python_stubs\498501734\kivy_event.py 文件呢,
答案在这里:
https://stackoverflow.com/questions/24266114/pycharm-what-is-python-stubs

写就是说这个文件时pycahrm为我们根据pyd文件生成的,为方便调试代码, 在.PyCharm2018.3\system\python_stubs\498501734\kivy\_event.py文件都已经
有详细的说明了:

# encoding: utf-8
# module kivy._event
# from xxxx\lib\site-packages\kivy\_event.cp36-win32.pyd
# by generator 1.146
"""
Event dispatcher
================

All objects that produce events in Kivy implement the :class:`EventDispatcher`
which provides a consistent interface for registering and manipulating event
handlers.

.. versionchanged:: 1.0.9
    Property discovery and methods have been moved from the
    :class:`~kivy.uix.widget.Widget` to the :class:`EventDispatcher`.
"""

Kivy Event 在哪里?

标签:which   gen   The   rom   调试   and   uri   handlers   rod   

原文地址:https://www.cnblogs.com/onsunsl/p/12250828.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!