Top-rated recipes tagged "ui"http://code.activestate.com/recipes/tags/ui/top/2015-03-29T20:45:57-07:00ActiveState Code RecipesInline GIF's with Tkinter (Python)
2004-01-30T16:43:32-08:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52264-inline-gifs-with-tkinter/
<p style="color: grey">
Python
recipe 52264
by <a href="/recipes/users/98036/">Brent Burley</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 2.
</p>
<p>This recipe will let you embed GIF images inside of your source code
for use in Tkinter buttons, labels, etc. It's really handy for making
toolbars, etc. without worrying about having the right icon files
installed.</p>
<p>The basic technique is to encode the GIF with base64 and store it
as a string literal in the Python code to be passed to Tk PhotoImage.</p>
MultiListbox Tkinter widget (Python)
2001-03-14T17:42:44-08:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52266-multilistbox-tkinter-widget/
<p style="color: grey">
Python
recipe 52266
by <a href="/recipes/users/98036/">Brent Burley</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>This is a compound widget that gangs multiple Tk Listboxes to a single
scrollbar to achieve a simple multi-column scrolled listbox. Most of
the Listbox API is mirrored to make it act like the normal Listbox
but with multiple values per row.</p>
Easy Cross Platform Excel Parsing With Xlrd (Python)
2006-04-07T22:45:51-07:00Bryan Niederbergerhttp://code.activestate.com/recipes/users/2843232/http://code.activestate.com/recipes/483742-easy-cross-platform-excel-parsing-with-xlrd/
<p style="color: grey">
Python
recipe 483742
by <a href="/recipes/users/2843232/">Bryan Niederberger</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 3.
</p>
<p>Easily extract data from microsoft excel files using this wrapper class for xlrd (<a href="http://www.lexicon.net/sjmachin/xlrd.htm" rel="nofollow">http://www.lexicon.net/sjmachin/xlrd.htm</a>). The class allows you to create a generator which returns excel data one row at a time as either a list or dictionary. I found this very handy for easily pulling in a variety of excel files without having to deal with COM calls or even needing to have windows.</p>
Romantic love poem in Python (Python)
2014-09-04T09:34:16-07:00Damian Parniewiczhttp://code.activestate.com/recipes/users/2913290/http://code.activestate.com/recipes/496781-romantic-love-poem-in-python/
<p style="color: grey">
Python
recipe 496781
by <a href="/recipes/users/2913290/">Damian Parniewicz</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 3.
</p>
<p>This recipe was written for my beautiful girl...however signification of this code is universal</p>
Set Process Priority In Windows (Python)
2006-06-02T07:05:41-07:00Bryan Niederbergerhttp://code.activestate.com/recipes/users/2843232/http://code.activestate.com/recipes/496767-set-process-priority-in-windows/
<p style="color: grey">
Python
recipe 496767
by <a href="/recipes/users/2843232/">Bryan Niederberger</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>This function allows you to set process priority under windows. It defaults to setting the priority of the current python process but can set anything for which you have a process ID. I find it handy to set a long-running job with lower than normal priority so the computer doesn't feel sluggish while it runs.</p>
Determine size of console window on Windows (Python)
2006-04-29T20:26:33-07:00Alexander Belchenkohttp://code.activestate.com/recipes/users/2623877/http://code.activestate.com/recipes/440694-determine-size-of-console-window-on-windows/
<p style="color: grey">
Python
recipe 440694
by <a href="/recipes/users/2623877/">Alexander Belchenko</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 3.
</p>
<p>This recipe is Python implementation of few lines of C-code that get useful information about current working console on Windows. It may be useful for console application to proper formatting output. Recipe need ctypes package to be installed.</p>
<p>This is the second version of recipe. When use handle of stdout for determining size of console and connect output of program via pipe to another program (e.g. pager 'more') then you get default 80x25 size. In case of using handle of stderr for this purpose then pipe don't destroy actual size.</p>
ObserverProxy (Python)
2005-05-10T09:26:05-07:00Ori Peleghttp://code.activestate.com/recipes/users/2056315/http://code.activestate.com/recipes/413701-observerproxy/
<p style="color: grey">
Python
recipe 413701
by <a href="/recipes/users/2056315/">Ori Peleg</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 2.
</p>
<p>Create an proxy that forwards methods to a group of observers</p>
Entering accented characters in Tkinter widgets (Python)
2005-01-12T22:00:07-08:00Artur de Sousa Rochahttp://code.activestate.com/recipes/users/343771/http://code.activestate.com/recipes/286155-entering-accented-characters-in-tkinter-widgets/
<p style="color: grey">
Python
recipe 286155
by <a href="/recipes/users/343771/">Artur de Sousa Rocha</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 4.
</p>
<p>This module provides two standard Tkinter widgets, Entry and ScrolledText, modified for text editing with key bindings that allow entering accented letters, umlauts, etc.</p>
<p>Usage: To enter an accented character, press Ctrl-symbol, then press the character key. Example: to enter U with umlaut, press Ctrl-", U. For accent symbols that need shift, press Ctrl-Shift-symbol (for example, Ctrl-Shift-' if " is under Shift-').</p>
<p>Accent bindings are defined in the Diacritical.accent table. Not all accents exist on all letters. This is handled by gracefully falling back to the base letter.</p>
<p>Additional changes in default Tk key bindings: Ctrl-A is now select-all.</p>
A simple Tkinter notebook-like widget (Python)
2004-12-26T19:11:42-08:00Iuri Wickerthttp://code.activestate.com/recipes/users/111694/http://code.activestate.com/recipes/188537-a-simple-tkinter-notebook-like-widget/
<p style="color: grey">
Python
recipe 188537
by <a href="/recipes/users/111694/">Iuri Wickert</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 4.
</p>
<p>You have some single-toplevel Tkinter apps that you want to organize in a notebook-like fashion, associating each tab to an app, in a way which requires minimal changes in your original apps. This simple notebook class allows that, also supporting different tab orientations (TOP, BOTTOM, LEFT & RIGHT).</p>
MultiListbox Tkinter widget (Python)
2014-01-03T19:23:48-08:00Juan Ramirezhttp://code.activestate.com/recipes/users/4174026/http://code.activestate.com/recipes/578805-multilistbox-tkinter-widget/
<p style="color: grey">
Python
recipe 578805
by <a href="/recipes/users/4174026/">Juan Ramirez</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>This is a compound widget that gangs multiple Tk Listboxes to a single
scrollbar to achieve a simple multi-column scrolled listbox. Most of
the Listbox API is mirrored to make it act like the normal Listbox
but with multiple values per row.</p>
Easily creating dialog boxes from XRC files (Python)
2006-07-06T14:39:56-07:00Walker Halehttp://code.activestate.com/recipes/users/2928779/http://code.activestate.com/recipes/496868-easily-creating-dialog-boxes-from-xrc-files/
<p style="color: grey">
Python
recipe 496868
by <a href="/recipes/users/2928779/">Walker Hale</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>This module allows creating and running a custom dialog box with a single function call. The custom dialog box must first be defined in an external XRC file. Editors like XRCed and wxGlade allow easily designing custom dialog boxes. You can then invoke the dialog box even if your application has no other GUI.</p>
Call a Callback when a Tkinter.Text is Modified (Python)
2005-12-15T23:00:43-08:00Simon Formanhttp://code.activestate.com/recipes/users/2702520/http://code.activestate.com/recipes/464635-call-a-callback-when-a-tkintertext-is-modified/
<p style="color: grey">
Python
recipe 464635
by <a href="/recipes/users/2702520/">Simon Forman</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 2.
</p>
<p>A Tkinter.Text can notice when its contents are changed. This recipe shows how to make use of the virtual event this generates to call your own callback.</p>
Windows clipboard viewer (Python)
2004-12-04T12:50:56-08:00Georg Nelleshttp://code.activestate.com/recipes/users/2176948/http://code.activestate.com/recipes/355593-windows-clipboard-viewer/
<p style="color: grey">
Python
recipe 355593
by <a href="/recipes/users/2176948/">Georg Nelles</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>With the "SetClipboardViewer" function you can add a window to the chain of clipboard viewers. Whenever the content of the clipboard changes, a message is send to the clipboard viewer windows. A clipboard viewer window must process two messages and pass them to the next window in the chain.
With a sample about hooking the window procedure of a wxPython Frame, I made up the following clipboard viewer.</p>
Getting the data dropped on a window (Python)
2004-12-01T16:00:16-08:00Valentino Volonghihttp://code.activestate.com/recipes/users/199559/http://code.activestate.com/recipes/355203-getting-the-data-dropped-on-a-window/
<p style="color: grey">
Python
recipe 355203
by <a href="/recipes/users/199559/">Valentino Volonghi</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>Using pygtk and glade you can easily write all you need to provide a log text buffer to output the data dropped.</p>
IronPython fade-in window (Python)
2004-09-02T01:58:08-07:00Brian Quinlanhttp://code.activestate.com/recipes/users/118989/http://code.activestate.com/recipes/303062-ironpython-fade-in-window/
<p style="color: grey">
Python
recipe 303062
by <a href="/recipes/users/118989/">Brian Quinlan</a>
(<a href="/recipes/tags/ui/">ui</a>).
</p>
<p>This recipe describes how to create a fade-in window using IronPython. Several applications use fade-in windows for temporary data e.g. new Outlook XP mail messages are shown through a fade-in/fade-out pop-up window.</p>
<p>Fading in can be best accomplished using the Form.Opacity property and a Timer. Pop-up windows should also set the "topmost" window style.</p>
Stopwatch in Tkinter (Python)
2002-05-23T13:51:38-07:00Jørgen Cederberghttp://code.activestate.com/recipes/users/359004/http://code.activestate.com/recipes/124894-stopwatch-in-tkinter/
<p style="color: grey">
Python
recipe 124894
by <a href="/recipes/users/359004/">Jørgen Cederberg</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 2.
</p>
<p>This is a small implementation of a stopwatch widget in Tkinter. The widget displays a label with minutes:seconds:1/100-seconds. The label is updated every 50 ms, but that can easily be changed. Methods are availble for starting, stopping and resetting the stopwatch. A simple program demonstrates the widget.</p>
Building GTK GUIs interactively (Python)
2001-09-27T15:49:21-07:00Brian McErleanhttp://code.activestate.com/recipes/users/111980/http://code.activestate.com/recipes/65109-building-gtk-guis-interactively/
<p style="color: grey">
Python
recipe 65109
by <a href="/recipes/users/111980/">Brian McErlean</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 3.
</p>
<p>One of pythons greatest strengths is the ability to try things interactively at the interpreter.
Using Tkinter shares this strength, since one can create buttons, windows and other widgets,
and instantly see them onscreen, click on buttons to activate callbacks and still be able to
edit and add to the widgets from the python command line.</p>
<p>While the python GTK bindings are generally excellent, one of their flaws is that this is not possible.
Before anything is actually displayed, the gtk.mainloop() function must be called, ending the
possibility of interactive manipulation.</p>
<p>This recipe is a program which simulates a python interpreter which transparently allows the user to
use gtk widgets without having to call mainloop(), in much the same way as Tk widgets.</p>
<p>This latest version contains enhancements added by Christian Robottom Reis to add readline completion support.</p>
Shortcut Utility (Python)
2015-03-29T20:45:57-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579041-shortcut-utility/
<p style="color: grey">
Python
recipe 579041
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/desktop/">desktop</a>, <a href="/recipes/tags/directories/">directories</a>, <a href="/recipes/tags/directory/">directory</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/ui/">ui</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>).
</p>
<p>I dislike filling my desktop with shortcut icons in Windows.
This code enables creating shortcuts in a CSV file.</p>
Geometry class for Tkinter (Python)
2013-03-18T14:49:16-07:00David Cornehttp://code.activestate.com/recipes/users/4185735/http://code.activestate.com/recipes/578494-geometry-class-for-tkinter/
<p style="color: grey">
Python
recipe 578494
by <a href="/recipes/users/4185735/">David Corne</a>
(<a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/ui/">ui</a>).
Revision 2.
</p>
<p>An easily extensible class, inheriting from Canvas, which can be used to define geometry in a more mathematical way. So rather than specify a circle from 2 points you give a radius and a centre. These could have colour as a keyword argument but personally I always want to specify the colour.</p>
Accented Characters for Tkinter Widgets (Python)
2011-01-07T13:09:51-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576950-accented-characters-for-tkinter-widgets/
<p style="color: grey">
Python
recipe 576950
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 3.
</p>
<p>See <a href="http://code.activestate.com/recipes/286155/">Recipe 286155</a> for original code and author.</p>
<p>This module provides two standard Tkinter widgets, Entry and ScrolledText, modified for text editing with key bindings that allow entering accented letters, umlauts, etc.</p>
<p>Usage: To enter an accented character, press Ctrl-symbol, then press the character key. Example: to enter U with umlaut, press Ctrl-", U. For accent symbols that need shift, press Ctrl-Shift-symbol (for example, Ctrl-Shift-' if " is under Shift-').</p>
<p>Accent bindings are defined in the Diacritical.accent table. Not all accents exist on all letters. This is handled by gracefully falling back to the base letter.</p>
<p>Additional changes in default Tk key bindings: Ctrl-A is now select-all.</p>