Popular recipes not tagged "fitz"http://code.activestate.com/recipes/tags/-fitz/2017-07-17T05:53:45-07:00ActiveState Code RecipesUno (Text-Based) (Python)
2017-07-15T00:46:59-07:00Brandon Martinhttp://code.activestate.com/recipes/users/4194238/http://code.activestate.com/recipes/580811-uno-text-based/
<p style="color: grey">
Python
recipe 580811
by <a href="/recipes/users/4194238/">Brandon Martin</a>
(<a href="/recipes/tags/artificial_intelligence/">artificial_intelligence</a>, <a href="/recipes/tags/cards/">cards</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/text_game/">text_game</a>, <a href="/recipes/tags/uno/">uno</a>).
</p>
<p>A text based recreation of the classic card game featuring functional AIs to play with. Some rules have been modified. User interface is text based, non-curses, using only simple python commands to draw it. </p>
Frame with border color for Tkinter (Python)
2017-04-17T11:25:02-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580735-frame-with-border-color-for-tkinter/
<p style="color: grey">
Python
recipe 580735
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/border/">border</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/frame/">frame</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
</p>
<p>This trick show how to add a border color to frame. These are the important configurations:</p>
<pre class="prettyprint"><code> highlightbackground="your border color here"
highlightcolor="your border color here"
highlightthickness="the border width"
bd= 0
</code></pre>
The Game of Tic Tac Toe in Python (Python)
2014-01-31T02:39:48-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578816-the-game-of-tic-tac-toe-in-python/
<p style="color: grey">
Python
recipe 578816
by <a href="/recipes/users/4184772/">Captain DeadBones</a>
(<a href="/recipes/tags/beginner/">beginner</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>I thought this is a fun game to program. Easy to program and can teach a lot. </p>
<p><a href="http://thelivingpearl.com">Captain DeadBones</a></p>
Convert Microsot Excel (XLSX) to PDF with Python and xtopdf (Python)
2015-11-22T22:15:25-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579128-convert-microsot-excel-xlsx-to-pdf-with-python-and/
<p style="color: grey">
Python
recipe 579128
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/excel/">excel</a>, <a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/openpyxl/">openpyxl</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/xlsx/">xlsx</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how the basics of to convert the text data in a Microsoft Excel file (XLSX format) to PDF (Portable Document Format). It uses openpyxl to read the XLSX file and xtopdf to generate the PDF file.</p>
Implementing function-based callbacks in Python (Python)
2017-04-19T18:03:11-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580787-implementing-function-based-callbacks-in-python/
<p style="color: grey">
Python
recipe 580787
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/callback/">callback</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/functions/">functions</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/techniques/">techniques</a>).
</p>
<p>This recipe shows a simple way of implementing callbacks in Python. There are a few ways this can be done. The way shown here uses a simple function-based approach.</p>
<p>In a nutshell, a callback can be informally described like this: function <strong>a</strong> calls function <strong>b</strong>, and wants to make <strong>b</strong> run a specific independent chunk of code at some point during <strong>b</strong>'s execution. We want to be able to vary which chunk of code gets called in different calls to <strong>b</strong>, so it cannot be hard-coded inside <strong>b</strong>. So function <strong>a</strong> passes another function, <strong>c</strong>, to <strong>b</strong>, as one argument, and <strong>b</strong> uses that parameter <strong>c</strong> to call the functionality that <strong>a</strong> wants <strong>b</strong> to call. (Function <strong>b</strong> may pass some parameters to the function represented by <strong>c</strong>, when it calls it. These could be either internally generated, passed from <strong>a</strong>, or a combination of both). So, by changing the value of the function <strong>c</strong> that gets passed to <strong>b</strong> (on different calls to <strong>b</strong>), <strong>a</strong> can change what chunk of code <strong>b</strong> calls.</p>
<p>More details and full code, description and output here:</p>
<p><a href="https://jugad2.blogspot.in/2017/04/implementing-and-using-callbacks-in.html" rel="nofollow">https://jugad2.blogspot.in/2017/04/implementing-and-using-callbacks-in.html</a></p>
Implementing class-based callbacks in Python (Python)
2017-04-20T23:34:50-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580788-implementing-class-based-callbacks-in-python/
<p style="color: grey">
Python
recipe 580788
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/callbacks/">callbacks</a>, <a href="/recipes/tags/classes/">classes</a>, <a href="/recipes/tags/functions/">functions</a>, <a href="/recipes/tags/methods/">methods</a>, <a href="/recipes/tags/objects/">objects</a>, <a href="/recipes/tags/programming/">programming</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>This is a follow-on to this recently posted recipe:</p>
<p>Implementing function-based callbacks in Python:
<a href="https://code.activestate.com/recipes/580787-implementing-function-based-callbacks-in-python/?in=user-4173351" rel="nofollow">https://code.activestate.com/recipes/580787-implementing-function-based-callbacks-in-python/?in=user-4173351</a></p>
<p>This new recipe shows how to create and use callbacks in Python, using classes with methods, instead of plain functions, as was done in the recipe linked above. All other points such as reasons and benefits for using callbacks, are more or less the same as mentioned in the previous recipe, except that class instances can carry state around, so to that extent, the two approaches are different.</p>
<p><a href="https://jugad2.blogspot.in/2017/04/python-callbacks-using-classes-and.html" rel="nofollow">https://jugad2.blogspot.in/2017/04/python-callbacks-using-classes-and.html</a></p>
Tkinter table with scrollbars (Python)
2017-05-06T19:06:05-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580793-tkinter-table-with-scrollbars/
<p style="color: grey">
Python
recipe 580793
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/scrollbars/">scrollbars</a>, <a href="/recipes/tags/table/">table</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
Revision 13.
</p>
<p>I created here a tkinter table with scrollbar support. I use one of my other recipes for the mousewheel support and scrolling:</p>
<p><a href="https://code.activestate.com/recipes/580640-scrolling-frame-with-mouse-wheel-support" rel="nofollow">https://code.activestate.com/recipes/580640-scrolling-frame-with-mouse-wheel-support</a></p>
Equally-spaced numbers (linspace) (Python)
2015-01-12T22:16:37-08:00Andrew Barnerthttp://code.activestate.com/recipes/users/4184316/http://code.activestate.com/recipes/579000-equally-spaced-numbers-linspace/
<p style="color: grey">
Python
recipe 579000
by <a href="/recipes/users/4184316/">Andrew Barnert</a>
(<a href="/recipes/tags/float/">float</a>, <a href="/recipes/tags/linspace/">linspace</a>, <a href="/recipes/tags/range/">range</a>, <a href="/recipes/tags/spread/">spread</a>).
</p>
<p>An equivalent of <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html"><code>numpy.linspace</code></a>, but as a pure-Python lazy sequence.</p>
<p>Like NumPy's <code>linspace</code>, but unlike the <a href="http://code.activestate.com/recipes/577068/"><code>spread</code></a> and <a href="http://code.activestate.com/recipes/577068/"><code>frange</code></a> recipes listed here, the <code>num</code> argument specifies the number of values, not the number of intervals, and the range is closed, not half-open.</p>
<p>Although this is primarily designed for floats, it will work for <code>Fraction</code>, <code>Decimal</code>, NumPy arrays (although this would be silly) and even <code>datetime</code> values.</p>
<p>This recipe can also serve as an example for creating lazy sequences.</p>
<p>See the discussion below for caveats.</p>
Shoelace Formula for polygonal area (Python)
2017-07-17T05:53:45-07:00Paddy McCarthyhttp://code.activestate.com/recipes/users/398009/http://code.activestate.com/recipes/580812-shoelace-formula-for-polygonal-area/
<p style="color: grey">
Python
recipe 580812
by <a href="/recipes/users/398009/">Paddy McCarthy</a>
(<a href="/recipes/tags/2d/">2d</a>, <a href="/recipes/tags/area/">area</a>).
</p>
<p>Copied, by author from "Paddy3118 Go deh!: Python investigation of the Shoelace Formula for polygonal area <a href="http://paddy3118.blogspot.com/2017/07/python-investigation-of-shoelace.html#ixzz4n43Dqhaa" rel="nofollow">http://paddy3118.blogspot.com/2017/07/python-investigation-of-shoelace.html#ixzz4n43Dqhaa</a> " Where there is more meat on the bone (under a different license though).</p>
Simple multicolumn listbox for tkinter (Python)
2017-05-02T22:27:15-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580794-simple-multicolumn-listbox-for-tkinter/
<p style="color: grey">
Python
recipe 580794
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/listbox/">listbox</a>, <a href="/recipes/tags/multicolumn/">multicolumn</a>, <a href="/recipes/tags/table/">table</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
</p>
<p>This recipe makes easy to work a treeview widget like a table.</p>
<p>It has several options for styling:</p>
<ul>
<li>heading_anchor</li>
<li>heading_font</li>
<li>heading_background</li>
<li>heading_foreground</li>
<li>cell_anchor</li>
<li>cell_background</li>
<li>cell_foreground</li>
<li>cell_font</li>
<li>cell_pady</li>
<li>height</li>
<li>padding</li>
<li>adjust_heading_to_content</li>
<li>stripped_rows</li>
<li>headers</li>
<li>selection_background</li>
<li>selection_foreground</li>
<li>field_background</li>
</ul>
<p>The "command" parameter is a callback and its called each time a row is selected.</p>
PDF Text Extraction using fitz / MuPDF (PyMuPDF) (Python)
2016-03-17T12:00:06-07:00Jorj X. McKiehttp://code.activestate.com/recipes/users/4193772/http://code.activestate.com/recipes/580626-pdf-text-extraction-using-fitz-mupdf-pymupdf/
<p style="color: grey">
Python
recipe 580626
by <a href="/recipes/users/4193772/">Jorj X. McKie</a>
(<a href="/recipes/tags/cbz/">cbz</a>, <a href="/recipes/tags/epub/">epub</a>, <a href="/recipes/tags/mupdf/">mupdf</a>, <a href="/recipes/tags/openxps/">openxps</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pymupdf/">pymupdf</a>, <a href="/recipes/tags/text_extraction/">text_extraction</a>, <a href="/recipes/tags/xps/">xps</a>).
</p>
<p>Extract all the text of a PDF (or other supported container types) at very high speed.
In general, text pieces of a PDF page are not arranged in natural reading order, but in the order they were entered during PDF creation.
This script re-arranges text blocks according to their pixel coordinates to achieve a more readable output, i.e. top-down, left-right.</p>
Simulating an unless (reverse if) statement in Python (Python)
2017-02-23T22:38:50-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580758-simulating-an-unless-reverse-if-statement-in-pytho/
<p style="color: grey">
Python
recipe 580758
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/features/">features</a>, <a href="/recipes/tags/if/">if</a>, <a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/programming/">programming</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/trick/">trick</a>).
</p>
<p>This recipe shows how to simulate an unless statement (a sort of reverse if, like Perl has), in Python. It is just for fun and as an experiment, not meant for real use, because the effect of unless can easily be got by negating the sense of the condition in an if statement.</p>
<p>More details and output here:</p>
<p><a href="https://jugad2.blogspot.in/2017/02/perl-like-unless-reverse-if-feature-in.html" rel="nofollow">https://jugad2.blogspot.in/2017/02/perl-like-unless-reverse-if-feature-in.html</a></p>
groupby() For Unsorted Input (Python)
2017-05-12T10:40:58-07:00Alfehttp://code.activestate.com/recipes/users/4182236/http://code.activestate.com/recipes/580800-groupby-for-unsorted-input/
<p style="color: grey">
Python
recipe 580800
by <a href="/recipes/users/4182236/">Alfe</a>
(<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/generators/">generators</a>, <a href="/recipes/tags/grouping/">grouping</a>, <a href="/recipes/tags/lazy/">lazy</a>).
</p>
<p>We all know the <code>groupby()</code> which is available in the <code>itertools</code> standard module. This one yields groups of consecutive elements in the input which are meant to be together in one group. For non-consecutive elements this will yield more than one group for the same key.</p>
<p>So effectively, <code>groupby()</code> only reformats a flat list into bunches of elements from that list without reordering anything. In practice this means that for input sorted by key this works perfect, but for unsorted input it might yield several groups for the same key (with groups for other keys in between). Typically needed, though, is a grouping with reordering if necessary.</p>
<p>I implemented a likewise lazy function (yielding generators) which also accepts ungrouped input.</p>
Tkinter frame with gradient (Python)
2017-03-11T03:43:56-08:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580761-tkinter-frame-with-gradient/
<p style="color: grey">
Python
recipe 580761
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/canvas/">canvas</a>, <a href="/recipes/tags/frame/">frame</a>, <a href="/recipes/tags/gradient/">gradient</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
Revision 4.
</p>
<p>Frame with linear gradient using PIL. </p>
<p>It's also possible to make the same trick using tkinter PhotoImage.</p>
<p><a href="http://stackoverflow.com/questions/10417524/why-is-photoimage-put-slow" rel="nofollow">http://stackoverflow.com/questions/10417524/why-is-photoimage-put-slow</a></p>
<p>But PIL is more efficient:</p>
<p><a href="https://groups.google.com/forum/#%21topic/comp.lang.python/nQ6YO-dTz10" rel="nofollow">https://groups.google.com/forum/#!topic/comp.lang.python/nQ6YO-dTz10</a></p>
<p>Possible values for <strong>orient</strong> are: <em>VERTICAL</em>, <em>HORIZONTAL</em>. If <strong>orient</strong> is "vertical", then width is mandatory. If <strong>orient</strong> is "horizontal", then height is mandatory. If <strong>steps</strong> is <em>None</em>, then the gradient is composed of adjacent lines.</p>
<p>One possible practical application of gradient frames are tool bars. Gradient guives a visual clue of when an area starts and when an area finish. </p>
Tkinter search box (Python)
2017-04-08T12:27:36-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580773-tkinter-search-box/
<p style="color: grey">
Python
recipe 580773
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/entry/">entry</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/searchbox/">searchbox</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
Revision 9.
</p>
<p>Instead of using two colors for active background and normal background, I use only one color and opacity parameter.</p>
<p>I trigger the feeling of a button using different colors when the mouse is and isn't over. Many modern HTML search boxes uses the same approach.</p>
<p>Command function receives text of entry box when button is pressed.</p>
Tkinter Link or Hyperlink Button (Python)
2017-04-07T11:51:26-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580774-tkinter-link-or-hyperlink-button/
<p style="color: grey">
Python
recipe 580774
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/button/">button</a>, <a href="/recipes/tags/hyperlink/">hyperlink</a>, <a href="/recipes/tags/link/">link</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/webbrowser/">webbrowser</a>).
Revision 6.
</p>
<p>If a background is not provided, the widget gets the background color from its container. The link button has two states: normal and visited. When the link is clicked, the state change to visited. When the link is clicked the action command is called. By default the text of the link has an underline. There is several options for customization.</p>
<p>I also added this megawidget to my "Metro UI Tkinter" recipe:</p>
<p><a href="https://code.activestate.com/recipes/580729-metro-ui-tkinter" rel="nofollow">https://code.activestate.com/recipes/580729-metro-ui-tkinter</a></p>
Variable Abbreviations (Python)
2017-06-22T11:57:20-07:00Alfehttp://code.activestate.com/recipes/users/4182236/http://code.activestate.com/recipes/580807-variable-abbreviations/
<p style="color: grey">
Python
recipe 580807
by <a href="/recipes/users/4182236/">Alfe</a>
(<a href="/recipes/tags/abbreviations/">abbreviations</a>, <a href="/recipes/tags/contextmanager/">contextmanager</a>, <a href="/recipes/tags/variables/">variables</a>, <a href="/recipes/tags/with/">with</a>).
</p>
<p>One sometimes has nice long speaking names vor variables, maybe things like <code>buildingList[foundIndex].height</code>, but would like to address these in a shorter fashion to be used within a formula or similar where lots of longs names tend to confuse any reader trying to understand the formula. Physicists use one-letter names for a reason.</p>
<p>For this I wrote a small context provider which allows using short names instead of long ones:</p>
<pre class="prettyprint"><code>with Abbr(h=buildingList[foundIndex].height, g=gravitationalConstant):
fallTime = sqrt(2 * h / g)
endSpeed = sqrt(2 * h * g)
print("Fall time:", fallTime)
print("End speed:", endSpeed)
</code></pre>
<p>For longer formulas this can reduce ugly multi-line expressions to clearly readable one-liners.</p>
<p>One could use this:</p>
<pre class="prettyprint"><code>h = buildingList[foundIndex].height
g = gravitationalConstant
fallTime = sqrt(2 * h / g)
endSpeed = sqrt(2 * h * g)
del g, h
print("Fall time:", fallTime)
print("End speed:", endSpeed)
</code></pre>
<p>to achieve the same result, but</p>
<ul>
<li>it would not look as clean and</li>
<li>the context provider solves the typical issues like cleanup on exception etc.</li>
</ul>
<p>Just using local variables without cleanup (like above without the <code>del</code> statement) also is an option of course, but that would clutter the variable name space unnecessarily.</p>
<p>CAVEATS: The implementation of <code>Abbr()</code> is a hack. If used as intended and described here, it should work just fine, though. But the hackish nature forces me to mention some things: Since at compile time the compiler decides that the <code>h</code> and <code>g</code> in the example must be global variables (because they aren't assigned in the function), it produces byte code accessing global variables. The context provider changes the global variable structure to fill the needs. (Overridden already existing global variables of the same name get restored properly at context exit.) This means some things:</p>
<ul>
<li>One cannot have a local variable of the same name in the frame surrounding the context manager.</li>
<li>Existing global variables are changed during the time of the context manager; so using names like <code>sys</code> or <code>os</code> for abbreviations might be a bad idea due to side-effects.</li>
</ul>
Guard against an exception in the wrong place (Python)
2017-06-25T17:17:43-07:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/580808-guard-against-an-exception-in-the-wrong-place/
<p style="color: grey">
Python
recipe 580808
by <a href="/recipes/users/4172944/">Steven D'Aprano</a>
(<a href="/recipes/tags/context/">context</a>, <a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/guard/">guard</a>, <a href="/recipes/tags/manager/">manager</a>).
Revision 2.
</p>
<p>Sometimes exception handling can obscure bugs unless you guard against a particular exception occurring in a certain place. One example is that <a href="https://www.python.org/dev/peps/pep-0479/">accidentally raising <code>StopIteration</code> inside a generator</a> will halt the generator instead of displaying a traceback. That was solved by PEP 479, which automatically has such <code>StopIteration</code> exceptions change to <code>RuntimeError</code>. See the discussion below for further examples.</p>
<p>Here is a class which can be used as either a decorator or context manager for guarding against the given exceptions. It takes an exception (or a tuple of exceptions) as argument, and if the wrapped code raises that exception, it is re-raised as another exception type (by default <code>RuntimeError</code>).</p>
<p>For example:</p>
<pre class="prettyprint"><code>try:
with exception_guard(ZeroDivisionError):
1/0 # raises ZeroDivisionError
except RuntimeError:
print ('ZeroDivisionError replaced by RuntimeError')
@exception_guard(KeyError)
def demo():
return {}['key'] # raises KeyError
try:
demo()
except RuntimeError:
print ('KeyError replaced by RuntimeError')
</code></pre>
Unit Testing Nested Functions (Python)
2016-11-10T10:23:11-08:00Alfehttp://code.activestate.com/recipes/users/4182236/http://code.activestate.com/recipes/580716-unit-testing-nested-functions/
<p style="color: grey">
Python
recipe 580716
by <a href="/recipes/users/4182236/">Alfe</a>
(<a href="/recipes/tags/introspection/">introspection</a>, <a href="/recipes/tags/nested/">nested</a>, <a href="/recipes/tags/unittests/">unittests</a>).
Revision 3.
</p>
<p>Python allows the declaration of nested functions. These are typically hard to unit test because using just the normal ways of calling they cannot be called from outside their surrounding function. So they cannot be considered a clearly separated unit and thus cannot be unit tested.</p>
<p>This is a drawback of using them, so many developers (especially the ones deep into test driven development who strive to have a high unit test coverage) tend to avoid them in favor for standalone functions which can be called from the unit tests without any hassle.</p>
<p>But not all solutions with nested functions can be written as elegant with standalone functions. Nested functions are powerful insofar that they can access the local variables of the surrounding function without any need to pass them into the nested function, thus the code can in many cases stay neat and tidy while using a standalone function instead might raise the need to pass the complete context in form of a bunch of parameters. Also, using nested functions makes their local usage clear to any reader and keeps the name space tight.</p>
<p>But at least in the standard CPython (i. e. not necessarily in Jython, etc.) the implementation of functions (and methods) allows to find the nested function's code, wrap it properly to give it its needed context and then call it from the outside. I wrote a small module which helps doing exactly this.</p>
Tkinter frame with different border sizes (Python)
2017-05-06T18:45:00-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580798-tkinter-frame-with-different-border-sizes/
<p style="color: grey">
Python
recipe 580798
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/border/">border</a>, <a href="/recipes/tags/size/">size</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
</p>
<p>This trick shows how to create a bordered frame with different border size in each side.</p>