Latest recipes tagged "canvas"http://code.activestate.com/recipes/tags/canvas/new/2017-06-06T03:48:09-07:00ActiveState Code RecipesInteractive Mandelbrot Fractal Using HTML5 Canvas (JavaScript) 2017-06-06T03:48:09-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/580804-interactive-mandelbrot-fractal-using-html5-canvas/ <p style="color: grey"> JavaScript recipe 580804 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/canvas/">canvas</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/math/">math</a>). </p> <p>Interactive Mandelbrot Fractal Using HTML5 Canvas.</p> <p>(Download and save as html file and open it.)</p> <p>(Tested only using Firefox browser.)</p> Metro Spinner for Tkinter (Python) 2017-04-10T21:14:36-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580777-metro-spinner-for-tkinter/ <p style="color: grey"> Python recipe 580777 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/canvas/">canvas</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/rotation/">rotation</a>, <a href="/recipes/tags/spinner/">spinner</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). </p> <p>I create a rotating image class <em>RotatingIcon</em> inspired and based on this code:</p> <p><a href="http://stackoverflow.com/questions/15736530/python-tkinter-rotate-image-animation" rel="nofollow">http://stackoverflow.com/questions/15736530/python-tkinter-rotate-image-animation</a></p> <p>Features:</p> <ul> <li>Methods to stop and start the animation</li> <li>The animation automically stops when the window is not mapped, and the animation continues when the window is mapped again</li> <li>Time setting to control the speed of the animation</li> <li>All the formats accepted for PIL could be used. XBM format is automatically converted to Tk Bitmap. The advantage of Bitmats is the possibility to change the color of the foreground.</li> </ul> <p>I added 6 different styles of spinners with different sizes.</p> <p>I used fontawesome.io for the icon generation.</p> <p>For more metro widgets see here:</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> 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> Canvas: static forms (JavaScript) 2013-08-08T13:34:41-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578626-canvas-static-forms/ <p style="color: grey"> JavaScript recipe 578626 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/canvas/">canvas</a>). Revision 2. </p> <p>Drawing static forms with canvas.</p> Python Tkinter Canvas Rectangle Selection Box (Python) 2010-10-01T02:17:50-07:00Sunjay Varmahttp://code.activestate.com/recipes/users/4174115/http://code.activestate.com/recipes/577409-python-tkinter-canvas-rectangle-selection-box/ <p style="color: grey"> Python recipe 577409 by <a href="/recipes/users/4174115/">Sunjay Varma</a> (<a href="/recipes/tags/canvas/">canvas</a>, <a href="/recipes/tags/rectangle/">rectangle</a>, <a href="/recipes/tags/selection/">selection</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). </p> <p>A simple, yet effective rectangle selection box. :)</p> <p>Works with a tkinter canvas! Just add the class and set it up like in the example code. The cross heir was my own touch, the RectTracker only draws a box.</p> <p>Have fun! And please don't just vote down, post what you don't like if you don't like it.</p>