Popular Python recipes tagged "meta:requires=wx"http://code.activestate.com/recipes/langs/python/tags/meta:requires=wx/2013-09-29T19:25:23-07:00ActiveState Code RecipesA 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>
A wxPython GUI To Create Sqlite3 Databases (Python)
2013-09-18T23:05:51-07:00toufic zaarourhttp://code.activestate.com/recipes/users/4187866/http://code.activestate.com/recipes/578665-a-wxpython-gui-to-create-sqlite3-databases/
<p style="color: grey">
Python
recipe 578665
by <a href="/recipes/users/4187866/">toufic zaarour</a>
(<a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/wxpython/">wxpython</a>).
Revision 2.
</p>
<p>A GUI built around wxPython in a way that will allow you to add to this application other forms and functionalities. The main DialogBox is to create,in a fast way, Sqlite3 databases that are used for web or applications development. In order to work properly, save the script in a separate directory.There is also more; each time you create a database a text file named "CreationLog.txt" will be created (for the first time you use the application or if it is not there) and updated, describing when and where was your database created and with what SQL query. 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>
wxPython: Dramatic, shaded 3-D buttons that look like round glass in a metal ring. (Python)
2011-11-19T17:37:07-08:00Edward Sitarskihttp://code.activestate.com/recipes/users/4180006/http://code.activestate.com/recipes/577951-wxpython-dramatic-shaded-3-d-buttons-that-look-lik/
<p style="color: grey">
Python
recipe 577951
by <a href="/recipes/users/4180006/">Edward Sitarski</a>
(<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/button/">button</a>, <a href="/recipes/tags/round/">round</a>, <a href="/recipes/tags/wxpython/">wxpython</a>).
</p>
<p>These buttons work like regular wx buttons and can be used the same way.</p>
<p>They are very dramatic and add a strong visual and artistic flair to your interface.
Use when there is something really significant and a regular button just doesn't cut it.</p>
<p>The buttons are drawn with gradient shading (no bitmaps). They can be any size and support any font.</p>
<p>This source has a self-test. Just run "python roundbutton.py".</p>
Hanoi Towers solver wxPython (Python)
2010-12-21T21:11:33-08:00A. Polinohttp://code.activestate.com/recipes/users/4176317/http://code.activestate.com/recipes/577511-hanoi-towers-solver-wxpython/
<p style="color: grey">
Python
recipe 577511
by <a href="/recipes/users/4176317/">A. Polino</a>
(<a href="/recipes/tags/hanoi/">hanoi</a>, <a href="/recipes/tags/problem/">problem</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/solver/">solver</a>, <a href="/recipes/tags/wx/">wx</a>).
Revision 3.
</p>
<p>It's a simple solver of the problem of Hanoi Tower with a minimal GUI written in wxPython. It can handle just 10 plates, due to windows size..however it's very simple to modify this and the 'pure' solver is not affected by this limitation</p>
Simple example of embeding plots in wx and running them interactively (Python)
2010-09-21T17:30:30-07:00Kaushik Ghosehttp://code.activestate.com/recipes/users/4166965/http://code.activestate.com/recipes/577402-simple-example-of-embeding-plots-in-wx-and-running/
<p style="color: grey">
Python
recipe 577402
by <a href="/recipes/users/4166965/">Kaushik Ghose</a>
(<a href="/recipes/tags/interactive/">interactive</a>, <a href="/recipes/tags/matplotlib/">matplotlib</a>, <a href="/recipes/tags/wx/">wx</a>).
</p>
<p>Simple code to show how to incorporate a pylab plot into wx and then interact with it. This can form the basis of windows/apps that plot various variables that can be changing in the background.</p>
wxPython PDF Viewer using Poppler (Python)
2010-04-15T17:43:27-07:00Marcelo Fernándezhttp://code.activestate.com/recipes/users/4173551/http://code.activestate.com/recipes/577195-wxpython-pdf-viewer-using-poppler/
<p style="color: grey">
Python
recipe 577195
by <a href="/recipes/users/4173551/">Marcelo Fernández</a>
(<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/poppler/">poppler</a>, <a href="/recipes/tags/python_poppler/">python_poppler</a>, <a href="/recipes/tags/viewer/">viewer</a>, <a href="/recipes/tags/wxpython/">wxpython</a>).
</p>
<p>This example shows a PDF Viewer class, which handles things like Zoom and Scrolling. It requires python-poppler and wxPython >= 2.8.9.</p>
CommentEditor: HTML editor for online comments (Python)
2009-06-17T12:10:55-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/576814-commenteditor-html-editor-for-online-comments/
<p style="color: grey">
Python
recipe 576814
by <a href="/recipes/users/4076953/">Jack Trainor</a>
(<a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/html/">html</a>, <a href="/recipes/tags/wxwidgets/">wxwidgets</a>).
Revision 3.
</p>
<p>Edit online comments with easy addition of HTML tags for bold, italics, underlining, blockquote and anchored links. Then check your work with the preview feature.</p>
<p>Requires wxWidgets.</p>
WxGrepDialog - Iterative construction of regular expressions (Python)
2008-07-18T08:48:01-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/576364-wxgrepdialog-iterative-construction-of-regular-exp/
<p style="color: grey">
Python
recipe 576364
by <a href="/recipes/users/4076953/">Jack Trainor</a>
(<a href="/recipes/tags/text/">text</a>).
</p>
<p>WxGrepDialog is a small GUI utility for testing regular expressions on specified text in main console window, allowing iterative development of working regular expressions.</p>
WxFileRenamer - GUI app for renaming files by regular expressions (Python)
2008-07-07T12:41:48-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/574448-wxfilerenamer-gui-app-for-renaming-files-by-regula/
<p style="color: grey">
Python
recipe 574448
by <a href="/recipes/users/4076953/">Jack Trainor</a>
(<a href="/recipes/tags/files/">files</a>).
</p>
<p>WxFileRenamer is a small GUI utility for renaming files in a directory with regular expressions, which allows the user to preview the changes before committing them to disk.</p>
Data Processing Shell (Python)
2008-01-24T16:26:43-08:00Brian Davishttp://code.activestate.com/recipes/users/4119187/http://code.activestate.com/recipes/543265-data-processing-shell/
<p style="color: grey">
Python
recipe 543265
by <a href="/recipes/users/4119187/">Brian Davis</a>
.
</p>
<p>I've found that I frequently need to open a file, do some processing on it and then load it into excel. This script provides a nice interface for opening the file using a wxPython dialog box, some code to load the result .csv file into excel using win32com and a function to contain the processing code. I should probably turn this into a module sometime...</p>
wxPython LED control (Python)
2007-09-30T14:39:03-07:00Ian Eloffhttp://code.activestate.com/recipes/users/2227021/http://code.activestate.com/recipes/533125-wxpython-led-control/
<p style="color: grey">
Python
recipe 533125
by <a href="/recipes/users/2227021/">Ian Eloff</a>
.
</p>
<p>A LED control that can have different colors, each associated with a state. The default is green, amber, and red. Calling ledControl.State = 1 will set the color of the LED to the color by that index (given as a list in the constructor.) In the default case 0 is red, 1 is amber, and 2 is green.</p>
A foldable panel with a Windows XP look and feel (wxPython) (Python)
2006-08-02T02:55:40-07:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/496929-a-foldable-panel-with-a-windows-xp-look-and-feel-w/
<p style="color: grey">
Python
recipe 496929
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
</p>
<p>I wrote this foldable panel to keep the look of my applications consistant with Windows. The code is extremely simple and is nowhere as flexible as the foldable panel already available in wxPython. Demo available in the code.</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>
Dynamic system tray icon (wxPython) (Python)
2006-03-21T09:55:22-08:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/475155-dynamic-system-tray-icon-wxpython/
<p style="color: grey">
Python
recipe 475155
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
Revision 2.
</p>
<p>This recipe generates a dynamic icon (2 vertical, 5 segment bar graphs) in the system tray.</p>
Progress Bar form WX in Child Thread of Main Python Code. (Python)
2006-04-14T09:30:59-07:00cheeng shu chinhttp://code.activestate.com/recipes/users/163970/http://code.activestate.com/recipes/491258-progress-bar-form-wx-in-child-thread-of-main-pytho/
<p style="color: grey">
Python
recipe 491258
by <a href="/recipes/users/163970/">cheeng shu chin</a>
(<a href="/recipes/tags/threads/">threads</a>).
Revision 2.
</p>
<p>I come across some cases, where I need to hook a progress bar from WX to my current running python project/script to indicate the current process progress.
Some how if you use MainLoop() in child thread will cause the WX session hang and EVT handle will failed.
After some study, found that WXAPP class instance and MainLoop have to same namespace.
I manage to redesign it and make it work now.
Just mail/vote me, if you feel this is useful for your project.
E-Mail : <a href="mailto:cheengshuchin@gmail.com">cheengshuchin@gmail.com</a></p>
Instant GUI compiler for testing purpose (Python)
2006-01-30T15:46:23-08:00Andre Robergehttp://code.activestate.com/recipes/users/2467063/http://code.activestate.com/recipes/473812-instant-gui-compiler-for-testing-purpose/
<p style="color: grey">
Python
recipe 473812
by <a href="/recipes/users/2467063/">Andre Roberge</a>
.
</p>
<p>I find that I often want to test some small code samples, too long to type at the interpreter (and retype, with some small changes), but not worth saving. The following wxPython based mini-app implements the basic for a small Python editor with a side output window. It also handles input() and raw_input().</p>
Changing the background color of the menu bar in a wxPython Windows app (Python)
2005-09-02T19:09:28-07:00Kartic Krishnamurthyhttp://code.activestate.com/recipes/users/2570233/http://code.activestate.com/recipes/440507-changing-the-background-color-of-the-menu-bar-in-a/
<p style="color: grey">
Python
recipe 440507
by <a href="/recipes/users/2570233/">Kartic Krishnamurthy</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 2.
</p>
<p>Using win32 API to change the background color of the menubar/menu items in a wxPython app without affecting system-wide settings.</p>
Emacs-like hotkey support for wxPython (Python)
2005-11-22T06:50:06-08:00Josiah Carlsonhttp://code.activestate.com/recipes/users/1241800/http://code.activestate.com/recipes/457407-emacs-like-hotkey-support-for-wxpython/
<p style="color: grey">
Python
recipe 457407
by <a href="/recipes/users/1241800/">Josiah Carlson</a>
(<a href="/recipes/tags/programs/">programs</a>).
Revision 2.
</p>
<p>Some people have a burning need for emacs-like multiple key sequence hotkeys. What do I mean? Ctrl+x Ctrl+s to save the currently open document and exit emacs.</p>
<p>Included as code is a sample wxPython program which implements multi-group keypress combinations, and will print 'hello!' in the statusbar if the combination Ctrl+Y Alt+3 Shift+B is entered. As you are entering a valid sequence of hotkeys, it will print your current combination in the status bar. If you make a mistake, it will print out your failed keyboard combination.</p>
<p>I use variants of the menu manupulation and keymap generation code in PyPE (<a href="http://pype.sf.net%29." rel="nofollow">http://pype.sf.net).</a></p>
ColumnSorterMixin with a Virtual wx.ListCtrl (Python)
2006-08-02T13:07:53-07:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/426407-columnsortermixin-with-a-virtual-wxlistctrl/
<p style="color: grey">
Python
recipe 426407
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
Revision 2.
</p>
<p>This recipe shows a way of using ColumnSorterMixin with virtual lists (wx.ListCtrl defined with the wx.LC_VIRTUAL flag). The sample code pretty much follows the wx.listctrl demo (provided with wxPython). The interesting bit is the TestVirtualList class and the musicdata dictionary (altogether lines 42 to 257). Remainder is provided to run the TestVirtualList class (or others from the wxdemo) standalone.</p>
<p>The idea is to combine an itemDataMap dictionary with an index table which defines the order in which the dictionary items are displayed. The actual display is handled by the virtual list using only the OnGetItemText, OnGetItemImage and OnGetItemAttr methods.</p>
<p>First of all, the 3 methods OnGetItemText OnGetItemImage and OnGetItemAttr must be declared. Following the ListCtrl demo and in addition to the self.itemDataMap dictionary, a self.itemIndexMap table defines the items order.</p>
<p>ColumnSorterMixin uses the SortItems, GetListrCtrl and GetSortImages methods which are redefined here.
GetListCtrl now returns self (to keep the mixin happy). GetSortImages is pretty much the same as in the ListCtrl demo, only it uses the art provider (needs better looking arrows, maybe). SortItems handles the sorting. It gets the column clicked from the mixin _col variable and the sorting order (ascending or descending) from the _colSortFlag table.</p>
Finding the location of the taskbar in wxPython (Python)
2005-07-05T14:36:28-07:00Jan Perssonhttp://code.activestate.com/recipes/users/985006/http://code.activestate.com/recipes/435908-finding-the-location-of-the-taskbar-in-wxpython/
<p style="color: grey">
Python
recipe 435908
by <a href="/recipes/users/985006/">Jan Persson</a>
.
</p>
<p>In Windows explorer the user can choose to have the taskbar field on any of the for sides of the screen (i.e top, bottom, left or right). This means that code that needs to display windows relative to this selection has to know where the taskbar is placed.</p>
<p>This little procedure finds the position of the taskbar field and returns "top",
"bottom", "left" or "right" depending on the choice of the user.</p>