Popular recipes tagged "interface"http://code.activestate.com/recipes/tags/interface/2016-04-13T11:53:21-07:00ActiveState Code RecipesHow to build dobble as a Mixed Integer program. (Python) 2016-04-13T11:53:21-07:00alexander bakerhttp://code.activestate.com/recipes/users/4166679/http://code.activestate.com/recipes/580641-how-to-build-dobble-as-a-mixed-integer-program/ <p style="color: grey"> Python recipe 580641 by <a href="/recipes/users/4166679/">alexander baker</a> (<a href="/recipes/tags/integer/">integer</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/mixed/">mixed</a>, <a href="/recipes/tags/program/">program</a>). </p> <p>A simple script to replicate the cards and symbols for the dobble game.</p> Fluent API method decorator (Python) 2015-07-08T13:20:58-07:00Oscar Byrnehttp://code.activestate.com/recipes/users/4192487/http://code.activestate.com/recipes/579078-fluent-api-method-decorator/ <p style="color: grey"> Python recipe 579078 by <a href="/recipes/users/4192487/">Oscar Byrne</a> (<a href="/recipes/tags/api/">api</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/decorators/">decorators</a>, <a href="/recipes/tags/fluent/">fluent</a>, <a href="/recipes/tags/interface/">interface</a>). </p> <p>A decorator for producing robust fluent API interfaces by returning a copy of self</p> A Phone Book GUI Built in wxPython Connected To Database Using Data Grid View (Python) 2013-09-29T19:25:23-07:00toufic zaarourhttp://code.activestate.com/recipes/users/4187866/http://code.activestate.com/recipes/578676-a-phone-book-gui-built-in-wxpython-connected-to-da/ <p style="color: grey"> Python recipe 578676 by <a href="/recipes/users/4187866/">toufic zaarour</a> (<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/datagridview/">datagridview</a>, <a href="/recipes/tags/graphical/">graphical</a>, <a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/interface/">interface</a>). </p> <p>this GUI as simple as it is explains some basic but important graphical database interfacing; "Add", "Edit","Delete","Search" and few others along with a data grid view. in order to work create an sqlite3 database as follows:</p> <p>data table : Phone, column 1 : ID, column 2 : name, column 3 : surname, column 4 : telephone.</p> <p>save the sqlite3 file as file.db in a folder called Data and place it in the same directory as your python script.</p> <p>if you want to create the sqlite3 database graphically use my previous post : <a href="http://code.activestate.com/recipes/578665-a-wxpython-gui-to-create-sqlite3-databases/" rel="nofollow">http://code.activestate.com/recipes/578665-a-wxpython-gui-to-create-sqlite3-databases/</a></p> <p>Also there is more: I did not use auto-number for 'id' because I also wanted to include in the code a renumbering script.</p> <p>I am pleased to receive all the suggestions and improvements on this site or to my e-mail directly if this is convenient to you.</p> <p>note: if you don't like the database table name, and columns name create your own but make sure to change them in the code as well! in the end life is great! remember that!</p> wrist friendly dictionary (Python) 2013-08-18T22:54:26-07:00Ariel Keselmanhttp://code.activestate.com/recipes/users/4187559/http://code.activestate.com/recipes/578644-wrist-friendly-dictionary/ <p style="color: grey"> Python recipe 578644 by <a href="/recipes/users/4187559/">Ariel Keselman</a> (<a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/nested/">nested</a>). </p> <p>this dictionary allows easy manual creation of nested hierarchies, like so:</p> <p>window.style.width=5</p> <p>or... </p> <p>window['background-color'].rgb= 255,255,255</p> Attribute - easy way to define interface (Python) 2011-03-06T12:49:30-08:00ilon asolothttp://code.activestate.com/recipes/users/4177080/http://code.activestate.com/recipes/577598-attribute-easy-way-to-define-interface/ <p style="color: grey"> Python recipe 577598 by <a href="/recipes/users/4177080/">ilon asolot</a> (<a href="/recipes/tags/attribute/">attribute</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>it is an enhanced property</p> <pre class="prettyprint"><code> * initialize attribute in class definition scope * easily keep the attribute behaviors in sub classes. * easy to define interface. * not afraid to forget the super(klass, self).__init__(...) :P </code></pre> Attribute - easy way to define interface (Python) 2011-02-20T16:31:08-08:00Hui Zhanghttp://code.activestate.com/recipes/users/4177055/http://code.activestate.com/recipes/577579-attribute-easy-way-to-define-interface/ <p style="color: grey"> Python recipe 577579 by <a href="/recipes/users/4177055/">Hui Zhang</a> (<a href="/recipes/tags/attribute/">attribute</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>it is an enhanced property</p> <pre class="prettyprint"><code> * initialize attribute in class definition scope * easily keep the attribute behaviors in sub classes. * easy to define interface. * not afraid to forget the super(klass, self).__init__(...) :P </code></pre> Component architecture through data descriptors and function decorators (Python) 2009-07-23T11:13:48-07:00Danny Ghttp://code.activestate.com/recipes/users/4164396/http://code.activestate.com/recipes/576852-component-architecture-through-data-descriptors-an/ <p style="color: grey"> Python recipe 576852 by <a href="/recipes/users/4164396/">Danny G</a> (<a href="/recipes/tags/abc/">abc</a>, <a href="/recipes/tags/abstract_base_class/">abstract_base_class</a>, <a href="/recipes/tags/component/">component</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/plugin/">plugin</a>). Revision 5. </p> <p>My desire was to design a class with defined attributes that when assigned on instances, would expand the instance's functionality. In other words if I create an instance of class A, then assign a 'component' attribute upon that instance, I should be able to call methods of the component object through the original instance. I believe this is somewhat similar to interfaces and abstract base classes (and I read up on both a bit), but I want to rely more on introspection of the object to see what it can do versus confining it to a set interface.</p> Components and Abilities (different implementation of Component architecture) (Python) 2009-07-23T13:26:32-07:00Danny Ghttp://code.activestate.com/recipes/users/4164396/http://code.activestate.com/recipes/576854-components-and-abilities-different-implementation-/ <p style="color: grey"> Python recipe 576854 by <a href="/recipes/users/4164396/">Danny G</a> (<a href="/recipes/tags/abc/">abc</a>, <a href="/recipes/tags/ability/">ability</a>, <a href="/recipes/tags/abstract_base_class/">abstract_base_class</a>, <a href="/recipes/tags/component/">component</a>, <a href="/recipes/tags/descriptor/">descriptor</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/plugin/">plugin</a>). Revision 6. </p> <p>I define a 'Component' as an attribute (typing optional) that instances can assign objects to. Nothing special there, but their usefulness comes in with 'Abilities'. If a class inherits from 'ClassWithAbilities', it will be given a special attribute 'abilities' that will grow/shrink when other classes with abilities are assigned to an instances attributes. It increases/decreases the functionality of the instance depending on what objects are assigned to it. All of these abilities are accessed through the 'abilities' attribute. This is a redesign of <a href="http://code.activestate.com/recipes/576852/"><a href="http://code.activestate.com/recipes/576852/">Recipe 576852</a></a>, but I believe is different enough to warrant a new recipe.</p> Send Email (Python) 2012-08-26T11:23:54-07:00sfwgeekhttp://code.activestate.com/recipes/users/4170734/http://code.activestate.com/recipes/576807-send-email/ <p style="color: grey"> Python recipe 576807 by <a href="/recipes/users/4170734/">sfwgeek</a> (<a href="/recipes/tags/argparse/">argparse</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/command/">command</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/line/">line</a>, <a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/send/">send</a>, <a href="/recipes/tags/smtplib/">smtplib</a>). Revision 5. </p> <p>A Command Line Interface (CLI) program to send email.</p> Method signature type checking decorator for Python 3 (Python) 2015-05-15T09:25:08-07:00Dmitry Dvoinikovhttp://code.activestate.com/recipes/users/2475216/http://code.activestate.com/recipes/572161-method-signature-type-checking-decorator-for-pytho/ <p style="color: grey"> Python recipe 572161 by <a href="/recipes/users/2475216/">Dmitry Dvoinikov</a> (<a href="/recipes/tags/checking/">checking</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/method/">method</a>, <a href="/recipes/tags/signature/">signature</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/type/">type</a>). Revision 8. </p> <p>This recipe allows nice and clean validation for method parameters/return values. It uses function annotations available in Python 3 for the actual signature specification.</p>