⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skype4py.utils.eventhandlingbase-class.html

📁 基于python的skype的API的说明文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<?xml version="1.0" encoding="ascii"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"          "DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>  <title>Skype4Py.utils.EventHandlingBase</title>  <link rel="stylesheet" href="epydoc.css" type="text/css" />  <script type="text/javascript" src="epydoc.js"></script></head><body bgcolor="white" text="black" link="blue" vlink="#204080"      alink="#204080"><!-- ==================== NAVIGATION BAR ==================== --><table class="navbar" border="0" width="100%" cellpadding="0"       bgcolor="#a0c0ff" cellspacing="0">  <tr valign="middle">  <!-- Home link -->      <th>&nbsp;&nbsp;&nbsp;<a        href="Skype4Py-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>  <!-- Tree link -->      <th>&nbsp;&nbsp;&nbsp;<a        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>  <!-- Index link -->      <th>&nbsp;&nbsp;&nbsp;<a        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>  <!-- Help link -->      <th>&nbsp;&nbsp;&nbsp;<a        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>  <!-- Project homepage -->      <th class="navbar" align="right" width="100%">        <table border="0" cellpadding="0" cellspacing="0">          <tr><th class="navbar" align="center"            ><a class="navbar" target="_top" href="https://developer.skype.com/wiki/Skype4Py">Skype4Py</a></th>          </tr></table></th>  </tr></table><table width="100%" cellpadding="0" cellspacing="0">  <tr valign="top">    <td width="100%">      <span class="breadcrumbs">        <a href="Skype4Py-module.html">Package&nbsp;Skype4Py</a> ::        <a href="Skype4Py.utils-module.html">Module&nbsp;utils</a> ::        Class&nbsp;EventHandlingBase      </span>    </td>    <td>      <table cellpadding="0" cellspacing="0">        <!-- hide/show private -->        <tr><td align="right"><span class="options"            >[<a href="frames.html" target="_top">frames</a            >]&nbsp;|&nbsp;<a href="Skype4Py.utils.EventHandlingBase-class.html"            target="_top">no&nbsp;frames</a>]</span></td></tr>      </table>    </td>  </tr></table><!-- ==================== CLASS DESCRIPTION ==================== --><h1 class="epydoc">Class EventHandlingBase</h1><p class="nomargin-top"><span class="codelink"><a href="Skype4Py.utils-pysrc.html#EventHandlingBase">source&nbsp;code</a></span></p><pre class="base-tree">object --+         |        <strong class="uidshort">EventHandlingBase</strong></pre><dl><dt>Known Subclasses:</dt><dd>      <ul class="subclass-list"><li><a href="Skype4Py.callchannel.ICallChannelManager-class.html">callchannel.ICallChannelManager</a></li><li>, <a href="Skype4Py.skype.ISkype-class.html">skype.ISkype</a></li>  </ul></dd></dl><hr /><p>This class is used as a base by all classes implementing event   handlers.</p>  <p>Look at known subclasses (above in epydoc) to see which classes will   allow you to attach your own callables (event handlers) to certain events  occuring in them.</p>  <p>Read the respective classes documentations to learn what events are   provided by them. The events are always defined in a class whose name   consist of the name of the class it provides events for followed by   <code>Events</code>). For example class <a   href="Skype4Py.skype.ISkype-class.html" class="link">ISkype</a> provides   events defined in <a href="Skype4Py.skype.ISkypeEvents-class.html"   class="link">ISkypeEvents</a>. The events class is always defined in the   same submodule as the main class.</p>  <p>The events class is just informative. It tells you what events you can  assign your event handlers to, when do they occur and what arguments   lists should your event handlers accept.</p>  <p>There are three ways of attaching an event handler to an event.</p>  <ol start="1">    <li>      <code>Events</code> object.      <p>Use this method if you need to attach many event handlers to many       events.</p>      <p>Write your event handlers as methods of a class. The superclass of      your class doesn't matter, Skype4Py will just look for methods with       apropriate names. The names of the methods and their arguments lists       can be found in respective events classes (see above).</p>      <p>Pass an instance of this class as the <code>Events</code> argument      to the constructor of a class whose events you are interested in. For      example:</p><pre class="literalblock">   import Skype4Py   class MySkypeEvents:       def UserStatus(self, Status):           print 'The status of the user changed'   skype = Skype4Py.Skype(Events=MySkypeEvents())</pre>      <p>The <code>UserStatus</code> method will be called when the status       of the user currently logged into skype is changed.</p>    </li>    <li>      <code>On...</code> properties.      <p>This method lets you use any callables as event handlers. Simply       assign them to <code>On...</code> properties (where       &quot;<code>...</code>&quot; is the name of the event) of the object       whose events you are interested in. For example:</p><pre class="literalblock">   import Skype4Py   def user_status(Status):       print 'The status of the user changed'   skype = Skype4Py.Skype()   skype.OnUserStatus = user_status</pre>      <p>The <code>user_status</code> function will be called when the       status of the user currently logged into skype is changed.</p>      <p>The names of the events and their arguments lists should be taken       from respective events classes (see above). Note that there is no       <code>self</code> argument (which can be seen in the events classes)       simply because our event handler is a function, not a method.</p>    </li>    <li>      <code>RegisterEventHandler</code> /       <code>UnregisterEventHandler</code> methods.      <p>This method, like the second one, also let you use any callables       as event handlers. However, it additionally let you assign many event      handlers to a single event.</p>      <p>In this case, you use <a       href="Skype4Py.utils.EventHandlingBase-class.html#RegisterEventHandler"      class="link">RegisterEventHandler</a> and <a       href="Skype4Py.utils.EventHandlingBase-class.html#UnregisterEventHandler"      class="link">UnregisterEventHandler</a> methods of the object whose       events you are interested in. For example:</p><pre class="literalblock">   import Skype4Py   def user_status(Status):       print 'The status of the user changed'   skype = Skype4Py.Skype()   skype.RegisterEventHandler('UserStatus', user_status)</pre>      <p>The <code>user_status</code> function will be called when the       status of the user currently logged into skype is changed.</p>      <p>The names of the events and their arguments lists should be taken       from respective events classes (see above). Note that there is no       <code>self</code> argument (which can be seen in the events classes)       simply because our event handler is a function, not a method.</p>    </li>  </ol>  <p><b>Important notes!</b></p>  <p>The event handlers are always called on a separate thread. At any   given time, there is at most one handling thread per event type. This   means that when a lot of events of the same type are generated at once,   handling of an event will start only after the previous one is handled.   Handling of events of different types may happen simultaneously.</p>  <p>In case of second and third method, only weak references to the event   handlers are stored. This means that you must make sure that Skype4Py is   not the only one having a reference to the callable or else it will be   garbage collected and silently removed from Skype4Py's handlers list. On   the other hand, it frees you from worrying about cyclic references.</p><!-- ==================== INSTANCE METHODS ==================== --><a name="section-InstanceMethods"></a><table class="summary" border="1" cellpadding="3"       cellspacing="0" width="100%" bgcolor="white"><tr bgcolor="#70b0f0" class="table-header">  <td align="left" colspan="2" class="table-header">    <span class="table-header">Instance Methods</span></td></tr><tr>    <td width="15%" align="right" valign="top" class="summary">      <span class="summary-type">bool</span>    </td><td class="summary">      <table width="100%" cellpadding="0" cellspacing="0" border="0">        <tr>          <td><span class="summary-sig"><a href="Skype4Py.utils.EventHandlingBase-class.html#RegisterEventHandler" class="summary-sig-name">RegisterEventHandler</a>(<span class="summary-sig-arg">self</span>,        <span class="summary-sig-arg">Event</span>,        <span class="summary-sig-arg">Target</span>)</span><br />      Registers any callable as an event handler.</td>          <td align="right" valign="top">            <span class="codelink"><a href="Skype4Py.utils-pysrc.html#EventHandlingBase.RegisterEventHandler">source&nbsp;code</a></span>                      </td>        </tr>      </table>          </td>  </tr><tr>    <td width="15%" align="right" valign="top" class="summary">      <span class="summary-type">bool</span>    </td><td class="summary">      <table width="100%" cellpadding="0" cellspacing="0" border="0">        <tr>          <td><span class="summary-sig"><a href="Skype4Py.utils.EventHandlingBase-class.html#UnregisterEventHandler" class="summary-sig-name">UnregisterEventHandler</a>(<span class="summary-sig-arg">self</span>,        <span class="summary-sig-arg">Event</span>,        <span class="summary-sig-arg">Target</span>)</span><br />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -